Boost logo

Boost :

From: Preston A. Elder (prez_at_[hidden])
Date: 2005-01-28 23:02:09


On Fri, 28 Jan 2005 15:28:31 -0500, John Eddy wrote:

> Thank you for pointing me to that. My implementation is quite different
> but I like many features of the Torjo library. Some of the major
> differences between the Torjo library and mine include:
--- CUT ---

Something else you might want to consider is different logging mechanisms.

I have written a logging scheme myself, though it is not char specific (so
it will support unicode logs), and it is based off boost::format to do the
log formatting. The reason for this is that I have applications that need
to support different languages, and the ordering of variables can be
different for different languages (think polish or something :P).

I implemented a callback mechanism that will be used when a FATAL
message is received (often people will want to do an exit(-1) or something
in there, who knows). I also added a hex logging facility - to do hex
dumps for you, which is exceedingly useful.

Plus I've implemented the logger as an interface, and have written several
'back-ends', including:
"simple": where you specify a std::ostream for log messages to go to, as
well as being able to specify the log output format.
"file": where you specify a file (using a file class of my own design) for
output, where you can not only specify the log output format, but how many
'backup' logs to keep (think blah.log, blah.log.0, blah.log.1, etc), how
big a log can get before it is cycled, and a command that should be
executed post-cycling (eg. gzip -9).
"net": where you specify a socket (again, using a class of my own design)
that all logs will be sent to (ala. netcat), as well as the format of the
log message.
"syslog": where you specify the UNIX syslog facility, and it will send
logs to IT.
I'm yet to do "eventlog" for the NT event logger, but you get the idea.

If you're going to submit something to boost (I'm all for it, btw), it
might be an idea to be able to make the logger extensible in the manner I
have described above - ie. allowing you to specify different logging
mechanisms and supporting unicode.

Though, I DO like the idea of being able to use variable log names.

If you want to look at my logging mechanism, you can see it here:
http://www.neuromancy.net/viewcvs/Mantra-I/include/mantra/log/?root=mantra

The interface file specifically is here:
http://www.neuromancy.net/viewcvs/Mantra-I/include/mantra/log/interface.h?root=mantra&rev=1.8&view=auto

Thanks,

-- 
PreZ :)
Founder. The Neuromancy Society (http://www.neuromancy.net)

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