Boost logo

Boost :

From: JD (jean.daniel.michaud_at_[hidden])
Date: 2007-03-31 16:47:04


Hello,

   So here is the question:
        "Is there any interest in a logging library for boost?"

   John Torjo did not answer my mail, beside I looked at pantheios. it
seems a little bit complex... My idea is that a logging library should
be _simple_ to use.

   Here is a small example:

// snippet on
#include <fstream>
#include <boost/logging.hpp>

int main(int argc, char **argv)
{
   BOOST_LOG_INIT(("[" >> boost::logging::level >> "],"
>> boost::logging::filename >> "("
>> boost::logging::line >> "),"
>> boost::logging::time >> ","
>> boost::logging::trace
>> boost::logging::eol), // log format
                       2); // log level

   BOOST_LOG_ADD_OUTPUT_STREAM(new std::ofstream("./output.log"));
   BOOST_LOG_ADD_OUTPUT_STREAM(&std::cout);

   BOOST_LOG(1, "something");
   BOOST_LOG(2, "something else");
   BOOST_LOG(3, "doesn't matter");
   char you_want[256] = "you want";
   BOOST_LOG(1, "Let's say " << you_want << " to display " << 2);

   return 0;
}
// snippet off

   You can find the first draft of a logging library in the boost
Sandbox vault. It consists of a header files, some examples and
documentation. Put the file at your boost root folder and unzip it.

   It compiles with msvc and vc-8_0. I'll try with gcc asap.

   So let me know if you think it worth something or not.

JD


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