Boost logo

Boost :

From: Shams (shams_at_[hidden])
Date: 2007-04-01 09:23:33


Hi,

After looking forward to a Boost Logging library for a while, I have been
playing with this idea.

This library http://channel.sourceforge.net/ which I believe the author is
working towards
including in Boost could be used to help write the logging library? Why
because it works both
acrosss local and remote machines and supports a asyncronous subscribing
machenism.

Boost.Logging could use Boost.Channel (hopefully) to allow doing of
something like below
somewhere along the lines of...

Boost.Logging Log;

// Some of these channels could be a built-in to Boost logging.

// add one channel at a time
Log.AddChannel(new SysLogOnLocal());
Log.AddChannel(new SysLogOnRemoteChannel("remote ip"));
Log.AddChannel(new SysLogLocalAndRemoteChannel(""remote ip");
Log.AddChannel(stdout);
Log.AddChannel(stderr);
Log.AddChannel(GuiWindow);

// add lots all together
Log.AddChannel(new LocalInfoChannel(), new LocalAndRemoteInfoChannel(), new
ErrorChannel(), new WarningChannel());

// writes to the info channel
Log.Write(LocalInfoChannel, "Hello World");

// writes to the info channel
Log.Write(LocalAndRemoteInfoChannel, "Hello World");

// writes to all the channels that the logger is subscribed to (nasty)...
Log.Write("Hello World");

The possibility and the power of this thing could be, well a powerful
logging library....
I suggest you look into this library during this design phase...

Thanks
Shams

-- 
"JD" <jean.daniel.michaud_at_[hidden]> wrote in message 
news:eumhck$vk2$1_at_sea.gmane.org...
> 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
>
> _______________________________________________
> Unsubscribe & other changes: 
> http://lists.boost.org/mailman/listinfo.cgi/boost
> 

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