[Box Backup-dev] COMMIT r285 - box/chris

Chris Wilson boxbackup-dev at fluffy.co.uk
Thu Dec 29 12:45:35 GMT 2005


Hi Martin,

> Would it be ok to submit a class level design for review? Nothing fancy
> (this isn't work :)), just something so we can comment if required.

I'm planning to implement:

A BOX_LOG(level, stuff) macro similar to the one you proposed, using
iostreams.

Macros BOX_TRACE, BOX_DEBUG, BOX_INFO, BOX_WARNING, BOX_ERROR, BOX_FATAL
which supply the LEVEL argument to BOX_LOG. BOX_TRACE is completely
compiled out of non-debug builds.

An abstract Logger class with two methods, Log(level, std::string), and
Filter(level). Implementations for Console and Syslog.

A hidden static std::vector<Logger> of enabled loggers, which can be
added and removed with static methods like Log::Syslog(bool),
Log::Console(bool), and also Log::Add(Logger&) and Log::Remove(Logger&)
for custom loggers.

A hidden static boolean to disable all logging temporarily, and a class
which you can create on the stack to disable logging and have it
re-enabled automatically when the class is destroyed.

A critical section on Win32 to prevent the vector of loggers from being
concurrently modified and used.

Do you need more detail?

Cheers, Chris.
-- 
  ___ __     _
 / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |




More information about the Boxbackup-dev mailing list