How odd. I was just going to spend my morning writing a new log Tool
for CP 3 that uses the builtin logging module.

Question for you: in Dejavu, I decided that providing a logger was
outside the scope, since Dejavu is meant to be a library, not a
framework. However, I still needed to provide a way to log events in
Dejavu code. I ended up putting a "log" function on the arena:

    def log(self, message, flag):
        """Default logger (writes to stdout). Feel free to replace."""
        if flag & self.logflags:
            if isinstance(message, unicode):
                print message.encode('utf8')
            else:
                print message

...with the expectation that users would monkeypatch in their own log
function as needed. I like the DRY-ness of this approach.

Although CP would provide a more complete default than the above, I
still feel that "logging management" is better left to TG than CP. That
is, CP shouldn't provide a logging facility and expect consumers like
TG to pass all messages (e.g. SQLObject logging) into it. Rather, I
think messages should flow *out* of CP and into a logger that TG
provides.

Does that jive with your worldview?


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to