Re: [Cppcms-users] booster::log
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-03-15 10:53:32
|
> >hi everyone, > >I'm searching for a good logger tool for c++ and found (oh what a >wonder) booster::log. >It's simple and powerfull. Nice to handle and everything. I found >boost.log too but can't install it, because I don't know how :D (funny, >isn't it?) Boost.Log passed a formal review about a year ago but needs lots of updates and meanwhile it is not ready. >Would it be possible to add two things?! > - add a constructor for sinks::file which takes the file name as a > parameter and optionally the max files? It would be easier to construct > this, because you don't have to create a pointer (or whatever) first and > then hand it over to the logger 1. You will still need to write something like booster::log::logger::instance().add_skink(booster::shared_ptr<booster::log::sink>(new booster::log::sinks::file(...))); 2. If you are using logger with CppCMS - it can configure it for you automatically: http://cppcms.com/wikipp/en/page/cppcms_1x_config#logging 3. Yes I can add an option :-), fill a request feature ticket or send a patch. > - add a constructor to sinks::standard_error which takes a ostream as >parameter. Maybe you define an other class that does this. The standard_error sink is defined as simple as that: class standard_error : public booster::log::sink { public: void standard_error::log(message const &msg) { std::cerr << format_plain_text_message(msg) << std::endl; } }; So just write your own sink :-) > >and two other questions: > - what is the const char *module in should_be_logged, set_log_level > and so on? It's a "string", of course, but where do I get the string for > my sink?! This string is module name so you write: BOOSTER_WARNING("bank") << "We run out of money"; This is handled automatically by macros for you. This string is a part of the message object. > - Is it true, that I can only use booster without cppcms and that it's >licended under the boost license? > Yes, it is true. Booster is an answer of my needs from Boost that boost does not allow me to handle properly, that is why Booster has the same license as Boost. >Regards, > >Marcel Hellwig > Regards, Artyom Beilis |