Boost logo

Boost :

From: Preston A. Elder (prez_at_[hidden])
Date: 2005-01-29 01:31:30


On Sat, 29 Jan 2005 00:19:49 -0500, Caleb Epstein wrote:

> Meaning the logging level names?
No, the logging levels.

With my logger, you're locked into Fatal, Critical, Error, Warning,
Notice, Info and Debug as your log levels. If you wanted a few more of
them in between or to call them something different (in the code), you
couldn't. As far as the textual representation printed in the logs, that
is definable in my logger already.

> Can you comment on the thread safety (or lack thereof) of the Mantra
> log class? E.g. could multiple threads be writing to the same log
> simultaneously without messages getting smashed together?

This is dependant on the backend.

If you look in simple_impl.h, you will see the line:
boost::mutex::scoped_lock scoped_lock(writelock);

right before its going to write the lines it has just gotten back from
regex.

The same exists for the file (in the Write function that takes a vector
of log entries) and net interfaces. It does not exist for syslog, mainly
because syslog takes care of not mushing lines together so I don't have to.

So it should be completely thread safe :)

> Here are some add-ons to John Torjo's Logging library I wrote that
> implement a size-based rotating log like yours as well as a date-based
> one. If you want to archive data on a daily (or other) basis, this
> can be useful. They also allow a callback function to determine the
> log name, so users can implement custom filename policies.
>
> http://lists.boost.org/MailArchives/boost/msg74762.php

Thanks, I'll certainly take a look, since I'd been thinking about doing
that too, but trying to make it a sane mechanism made my head hurt ;)

-- 
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