Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2005-02-15 18:42:05


> int main(int argc, char* argv)
> {
> my_log alog;
> basic_log_manager<my_log > alm(alog);
> alm.log(my_e_data(__FILE__, __LINE__, "Bad Operation"));
> return 0;
> }

That is less scary than the earlier example. There is no way I'm going to
type that out every time but I can do:
   #define LOG(x) alm.log(my_e_data(__FILE__, __LINE__, (x)))

Hhmm, no, I've lost the ability to write:
   LOG("a="<<a<<",b="<<b);

So I guess I define my macro based on your earlier example:
   #define LOG(x) alm.log(basic_entry<>("") \
        << boost::posix_time::microsec_clock::local_time() \
         << "," << __FILE__ \
         << "," << __LINE__ \
        << "," << BOOST_CURRENT_FUNCTION \
         << ":" << (x))

Darren


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