Back to list
Views:   0
Replies:  0
Reply 1

[The question needs to be more clear, but somehow am able to get what you are looking for.]

My assumption:

When you get an error, you would pass your error object to an logging class, which will decide at runtime-
if it is an error (?) or just an info (?) and log that into appropriate source (like file, DB etc)

If yes, I would recommend to go for a Chain Of Responsibility pattern.

Steps I could think of :"

1) Build the chain of Loggers (File, email, DB etc.,)

2) Pass the error (or Info) obejct to First in the chain , say File Logger, this Class will decide if it need to log, if yes, will log and then send your "Error object" to next in the chain - say "Email Logger (sender)"

3) Email Logger Class will check if it eligible to be sent , if yes will send email and will pass it to next in the chain, say DB.

4) DB Logger will check and lets us assume its not a eligible one and will end the chain signallig the completion.

Please refer to my blog where I have talked more about this pattern (of course with  a Builder Pattern variation)

Hope this helps.


Tarriq Ferrose Khan

Tarriq Ferrose Khan, Aug 15, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas