Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2005-01-31 18:57:07


Here is a bullet point run-down of what I take to be the salient
features of libcwd, John Torjo's Proposed Boost.Log library, and what
I can glean from skimming Preston's "Mantra" Logger implementations.

These lists are by no means complete but I hope this helps to move the
discussion along.

libcwd (see http://libcwd.sourceforge.net/www/features.html):
* Part of a larger, mature library that provides logging, memory
allocation tracing and other debugging facilities.
* Thread-safe. Provides a separate libcwd_r for use in MT apps.
* Uses ostreams for formatting
* Supports "severity" levels on each message.
* Suggested API is macro-based. All logging code can thereby be
excluded from a build by ensuring the macro CWDEBUG is not defined.
* Output divided up into channels; user can create any number of new
namespace-protected channels; somewhat tortured syntax for doing so
(they must be in a namespace called "dc" nested inside a user-defined
namespace)
* Output directed to channel objects by passing them to a macro (e.g.
Dout (dc::notice, ...))

Torjo (need gmane URLs)
* Uses ostreams to format messages
* No concept of a message severity or level (suggested to use
different Log instances)
* Messages are directed to Logs. Logs have Modifiers and Appenders
associated with them. The set of Modifiers and Appenders in use is up
to the user.
* Modifiers are functors that take Messages and alter them (e.g.
prepend a timestamp, thread ID, append a newline, etc.).
* Appenders are functors that take the modified messages and do
something with them (e.g. write them to a file, syslog, etc).
* Logs must be declared in a header, defined in a different TU.
Helper macros provided to assist with this [this is the one feature I
most dislike]
* Log names may use namespace::name style
* "Appenders" are used to direct log messages to a file/device/etc.
Appenders are associated with one or more logs using a wild-cardable
string name
* Includes several Appender implementations including file, Win32
debug window, size/date-based rolling logs
* Output directed to Log objects by passing them to BOOST_LOG macro
(e.g. BOOST_LOG(ldebug) << ostream stuff)

Mantra (http://www.neuromancy.net/viewcvs/Mantra-I/include/mantra/log/?root=mantra)
* Part of a larger library ("Mantra") that provides networking, file
operations, persistence, and a bunch ofther stuff I'm sure I missed.
Much of this is built using Boost facilities. The Logger portion does
not seem to be tightly coupled to the rest.
* Logger paramaterized on charT type. Allows for wide-character output.
* Some of the Logger implementations depend on Boost.Thread to provide MT safety
* Uses Boost.Format for message formatting and also provides a
hex-dump output method.
* Messages include a "severity" level; Loggers are set to emit
messages of a specific severity or greater. Severity levels not
pluggable ATM.
* Provides a special hook for use when a Fatal message is logged.
* Includes several Logger implementations including file (with
automatic rollover based on size), socket, syslog
* No helper macros provided for "performance optimized" logging (e.g.
not formatting messages which won't get logged; compiling-out logging
code). This is surely easy to add however.
* Output directed to Loggers using logger.Write (LogLevel, boost::format object)

-- 
Caleb Epstein
caleb dot epstein at gmail dot com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk