[Box Backup-dev] Logging

Ben Summers boxbackup-dev at fluffy.co.uk
Sun Dec 25 19:44:32 GMT 2005


On 25 Dec 2005, at 19:09, Charles Lecklider wrote:

> Chris Wilson wrote:
> <lots of stuff about logging I only just read properly>
>
>> * All TRACE calls are changed to Log::Log(Log::TRACE, ...)
>
> How are you going to get those to compile out for a release build? The
> nice thing about TRACE macros is that they can be removed  
> completely by
> the compiler, and I think it's important to do that for a release  
> build.
>
> Short of wrapping every Log::TRACE call in #ifndef NDEBUG//#endif I
> don't see how you can do the same thing with the new system. Perhaps
> there's some clever C++ trick I don't know about?

There isn't. The best way is to modify the existing macros to use the  
underlying logging system, and still compile them out in release  
builds (unless the user has configured them to stay in.)

Using streams for generating the log messages will of course always  
construct the argument before logging, even if it's discarded by the  
call. I suspect this won't be too much of a problem, except on low  
powered embedded systems. I would quite like this to be able to fit  
into the hacked firmware of those consumer network connected hard  
discs and work acceptably on that low powered CPU.

Ben






More information about the Boxbackup-dev mailing list