$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Darren Cook (darren_at_[hidden])
Date: 2004-03-18 18:41:50
> I think it's the wrong approach. In our company we have implemented
> logging through macros which has one very important property: When I write
>
> LOG_DEBUG( whatever() );
I have a macro like this:
std::ostream *logfile=&std::cout; //Go to screen if not set
#define LOG(expr) \
*logfile<<"\n"<<BOOST_CURRENT_FUNCTION<<":"<<__LINE__<<":\n"<<expr
// To disable logging:
//#define LOG(expr) (void(0))
I can then use like this:
LOG("e="<<e<<", data:"<<*p);
The problem comes when I have a function that takes an ostream; then I have
to expose the internals:
LOG("Here is data:");LOG(obj->debug_info(*logfile,true,false));
Is there a better way?
Darren