Article Preview
Buy Now
COLUMN
Just-in-Time References
Another Delegate Example
Issue: 6.5 (July/August 2008)
Author: Charles Yeomans
Author Bio: Charles is a senior software engineer at Dakim, Inc.
Article Description: No description available.
Article Length (in bytes): 6,235
Starting Page Number: 46
Article Number: 6517
Related Link(s): None
Excerpt of article text...
Let me begin this issue's column with a brief sketch of a logging framework I wrote. The idea is that one has various targets for log messages -- file, console, system, memory. The targets are to be assigned and possibly changed at runtime. It supports sending messages to multiple targets, and filtering of messages by urgency -- fatal, error, warning, status, debug, trace.
This is expressed in code as a class interface, LogTarget, and several classes implementing LogTarget -- LogTargetFile, LogTargetConsole, etc. A LogTargetComposite class contains references to other LogTargets, and handles the forwarding of messages to these targets. And a LogTargetFilter class, which wraps another LogTarget, filters the messages it passes on.
Finally, there is a Logging module that holds a reference to a default target, plus methods that provide convenient, global access to that target.
...End of Excerpt. Please purchase the magazine to read the full article.