[ANN] Toothpick

Philippe Marschall philippe.marschall at gmail.com
Tue Nov 14 06:15:49 UTC 2006

2006/11/3, goran at krampe.se <goran at krampe.se>:
> Hi all!
> "Torsten Bergmann" <astares at gmx.de> wrote:
> > Toothpick - a simple configurable Logging mechanism for Smalltalk
> > is now also available as Monticello package on SqueakSource
> > and SqueakMap. I just converted the source zip into a monticello
> > package with kindly permission from Joseph Pelrine. His code is
> > released under BSD license.
> Great!
> I also saw this (from the Bern day) and intend to take a look but just
> wanted to mention:
> Gjallar has a small logging solution inside that would be interesting to
> compare/merge with this. It is small (4 classes IIRC) and has a Morphic
> tool as one of the backends. The next step would have been adding
> syslogd UDP to it - but I think Toothpick has this so it would be more
> interesting in merging I guess.
> If anyone wants to tackle this contact me or the setools list - the
> logging parts in Gjallar should be totally separate, but is not packaged
> separate right now (Q2Log, Q2LogFile, Q2LogMorph).
> It is not obvious that a merge is best - Q2Log (and friends) is very
> small and Squeak specific - both of which can be advantages compared to
> Toothpick. But Toothpick is obviously more capable.
> I include the class comment of Q2Log below.
> regards, Göran
> PS. There is also at least one more logger on SM. Btw, ripping out UDP
> code from Toothpick and adding that to Q2Log in the next 7 days would be
> a strong candidate for the Ipod competition.... :) Or any other
> interesting combo - like rewriting Q2Log as a facade to Toothpick, or
> whatever.
> ---------------------------------------
> Nice and simple logging. There are eight messages for logging based on
> severity. These correspond to the eight levels defined in syslog:
> 7 - debug (Debug-level messages)
> 6 - info (Informational)
> 5 - notice (Normal but significant Condition)
> 4 - warning (Warning Condition)
> 3 - err (Error Condition)
> 2 - crit (Critical Conditions)
> 1 - alert (must be handled immediately)
> 0 - emerg (System is unusable)
> The absolutely easiest way to log is like this:
>         Q2Log warn: 'Oopsidaisy'
> We only need to include the actual message in the string, timestamp etc
> is added automatically.
> You can also explicitly supply a "sender" object which can be anything
> you like, a symbol or a specific domain object even:
>         Q2Log warn: 'Yowsa' sender: #email
> Q2Log uses printString on the sender when producing the log entry, so if
> you use domain objects - make sure they have a unique printOn: method
> defined so that you can distinguish them. See class side category
> "logging" and "logging shorthand" for the available log messages.
> By default there is a single emitter registered that logs on Transcript,
> you can turn this off with:
>         Q2Log useTranscript: false
> And you can set a threshold for the above 8 syslog levels that should be
> logged onto Transcript using:
>         Q2Log instance transcriptMaxLevel: 4
> ..or set a global threshold for all emitters:
>         Q2Log instance globalMaxLevel: 4
> Global flushing of all emitters can be done using "Q2Log flush" and
> should ideally be called regularly by some background process.
> Finally take a look at Q2LogFile for details on how to add it as an
> emitter to get logging onto file instead of Transcript, and Q2LogMorph
> for getting logging into a very nice UI that offers filtering, searching
> etc.

There is a small package called syslog on SqueakSource [1] that does
logging to syslog (via UDP).
SyslogToothpick provides a Toothpick adapter.
SyslogFFI uses the syslog system call via FFI (likely only works on my machine).
SyslogFFIToothpick provides a Toothpick adapter for it.

They are not really tested and likely contain bugs.

I have some general questions about Toothpick:
- The FileLogger seems to overwrite the file for every logging event.
Is that correct or do I miss something?
- every Toothpick object that defines #initialize receives it twice.
Is that intended?
- The class documentation of LoggingEvent seems to be wrong. level is
an integer, not a symbol.
- Where is the part of XMLLoggingFormatter that does escaping? What's
the root node and where does it get written?

[1] http://www.squeaksource.com/syslog/


More information about the Squeak-dev mailing list