How to do logging (was Re: [squeak-dev] Files documentation)

Keith Hodges keith_hodges at yahoo.co.uk
Tue Nov 25 18:02:20 UTC 2008


Mariano Martinez Peck wrote:
> Göran: Yesterday night we have a very good discussion about logging in
> IRC. I was asking about Logging in order to add log to SqueakDBX. I
> think there were some interesting questions:
>
> 1) Should a framework, like SqueakDBX, log? Or this is a
> responsibility of the "user" of the framework ?
>
> Here, I will say: I think framework must log because it helps the
> framework team to find out bugs or give them information about it. I
> think this is something good. Obviously the framework should only log
> things related to the framework itself and not logic related with the
> user of it.
>
> 2) If so, should it be optional ?
> I think i must.  I mean, user can enable or disable it.
In Logging, not only does the user get to enable to backend of their
choice, but the user gets to choose a LogRouter.

If you subclass LogRouter you have complete control over what is and is
not logged. So different Logging policies can easily be defined.

What is required is some standardisation so that a consistent experience
is found accross multiple frameworks.
> 3) Suppose I want very much performance, and the user disable logging.
> Which is the best way of doing this?
The other way that I use, and it is talked about in the "Smalltalk
superpowers videos", is having the users client class in a framework
such that the logging version is a subclass. Thus the user can choose
whether or not to run your framework with logging enabled or not.

We do this in magma by setting choosing a ReadStrategy that logs stuff.
>
> 4) No matter 1) to 3), framework's user can log. I mean, it can do
> something like [xxxx] on: DBXError do:[ self log 'something' ]
>
> In fact, I decided (actually I must discuss with the team) to use
> Logging and SimpleLog in SqueakDBX.
>
> Any opinion about this?
>  
 Great news, I look forward to using SqueakDBX in the future

Keith



More information about the Squeak-dev mailing list