Send to Printer


ST 4U 215: Toothpick in VA Smalltalk

April 4, 2012 10:01:16.500

Today's Smalltalk 4 You looks at Toothpick for logging in VA Smalltalk. It's a lot like log4s, which we covered in other screencasts. The difference? Tootpick works across all the major Smalltalk dialects. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:


If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

You can also watch it on YouTube:

Today we'll take another look at logging in VA Smalltalk, but we'll use Tootpick - the cross platform logging solution for Smalltalk systems. First, download the ENVY package from Metaprog.

Once you have that, import the .dat file into your repository (see this screencast for an example of doing that). Then load SUnit support - it's an unlisted pre-req for the configuration map:


Once you have SUnit it, load the Toothpick config map:


Now we can proceed to use the same code that works in other Smalltalks. First, set up the logger (we'll use a Transcript logger here), and start the logging system:

"create a logger"
logger1 := TranscriptLogger new
			name: 'My first Logger'.

"where do logging events go"
logger1 format: SimpleLoggingFormatter defaultFormat.

"logging policy"
logger1 policy: (LoggingPolicy category: #debug level: #debug).

"register the logger"
(LoggingMultiplexer current)
	addLogger: logger1.

"Start the loggers"
(LoggingMultiplexer current) startAllLoggers.

That sets up the logger. Now we'll use it:

	category: #debug 
	level: #warn 
	message: 'using obsolete protocol'.

A quick look at the Transcript shows that it works as we intended:


Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.

Technorati Tags: , ,

[st4u215-iPhone.m4v ( Size: 3680673 )]

posted by James Robertson

 Share Tweet This