1. What is it?
2. Getting it
This project intends to provide C++ programmers with an easy interface to
logging facilities such as stderr, log files, syslog, and others that might
handy latter on. The interface is provided by global
std::ostream objects similar
cerr, this way the programmer can easylly port programs to this
library and take advantage off all user defined redefinitions of
Another of it's main features is the possibility of defining debug levels, for wich only inferior levels would be outputed, for example:
lerr << setDebugLevel(2) << level(1) << "hello" << level(3) << "world" << endl;
since our stream DebugLevel is 2.
This project came from the need to have a really simple interface to debug, and the inability to find a similar library wich could be used, with such a minimal set of modifications to code already written using cout and cerr.
You can find it in logstream sourceforge project site
Directly download it from here
Or access CVS from here
In your source code add:
use the following static objects:
lerr (stderr output)
lsyslog (syslog output)
as you would use cout or cerr.
Just add to your makefile:
g++ ... -L/path/to/liblogstream.so -llogstream ...
Attention: -L/path/to/liblogstream is optional, since you can have liblogstream.so path in your LD_PATH_LIBRARY enviroment variable or /etc/ld.so.conf file.
||sets the Debug level of the object to
||sets stream debug level to
||The string pointed to by
using namespace std;
using namespace logstream;
int main(int argc, char *argv)
lerr << setDebugLevel(1) <<"Hello world" << endl;
lsyslog << setDebugLevel(2) << setIdent(argv) << "testing syslog" << endl;
lsyslog << level(3) << "This is won't reach syslog" << endl;
lerr << level(1) << "Started doing something"<< endl;
lerr << level(2) << "You don't need to know what I'm doing" << endl;
lerr << level(1) << "All done :)" << endl;
Find more about me and my interest here
For bugs, contributions, comments and requests email me :)
Last Update April 1, 2003 1:48 AM