> We were thinking you could also pass an array of "destinations" as
> well.. so it would be sent to multiple loggers..  I failed to mention
> that.  Mike was big on keeping the destination within the Message
> object, so that our log() method wasn't tied to anything more than a
> Message object as a parameter.. which (after much heated debate) I see
> the benefit in.  He kept whacking me over the head with some Martin
> Fowler book ;)

Hmh. Well having only one parameter for log() makes sense. However, it has a
very serious drawback - you cannot extend Message anymore! With the
destination being a parameter of log(), people could easily pass whatever
they desire as a message. We could, tho, require messages to be derived from
AgaviLogMessage (I think LogMessage makes more sense!), so that they all
have to have a MyCustomLogMessage::$destination parameter or something.


> Sorry, I think I chose my words poorly.  We'd pass along the Message
> object, but it would be up to that Message object to (at some point
> down the road) provide a toString() method.  (of course it may provide
> lots of other methods!)  The Logger/Appender shouldn't be the ones
> translating the Message into a string... or at least that's what we
> were talking about this afternoon.

But why? Why not simply pass the Message to the Logger?


> I was thinking the Layout object would only be providing things like
> timestamp prepending, coloring, etc.. *modifying* the string output of
> the Message object, not buildling the actual output.
> 
> I don't know.. now I'm thinking I need to go back and re-evaluate what
> the Logger object is really "doing" other than holding references to a
> number of Appenders.

That's what the LoggerManager should do, IMO. And "Loggers" are actual
"instances" (not the right word) like "DatabaseLogger" or "EmailLogger", if
you ask me.


> It's not that I don't see the benefit of the second method.  I like
> Observers too ;)  I don't know.. I just think I see it as YAGNI.  I
> know what loggers I set up.  I know which logger(s) I want to send
> this message to when I create the Message... why spend the time
> sending the Message EVERYWHERE POSSIBLE when I can just direct it down
> to the Loggers I want to see it.  I know it allows for expansion down
> the road, so maybe that's the bottom line.

I see it as I Am Gonna Need It For Sure ;)

One example: You write an Open Source application based on Agavi. It has
logging capabilities. With the observer pattern, people can add their custom
loggers by adding a line to... logging.ini or whatever. Without the observer
pattern, they have to change the code in a lot(!) of places, and restore
these changes whenever they update their application.

I think you overestimate the performance impact. Logging is not that a big
deal in most apps; I expect 90% of the apps out there to have not more than
two loggers (which is an argument against Observer, I know, but since
implementing the Observer approach isn't more work at all initially I'm
strongly leaning towards doing it that way, especially because it's
difficult to add it afterwards without breaking BC).

> 
> >
> >
> > - David
> 
> Obviously I'm not rushing into any of this ;)  I know Mike's on
> vacation until Tuesday, but maybe we can all argue about this in IRC
> at some point =)

Sure, anytime ;)

- David


_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to