A simple logging library for C++
Log.cc is very easy to use.
To use log.cc for your own project, you only need to copy
src/log.cc
andsrc/log.h
to your own source directory.
#include "log.h"
int main()
{
logger l("log.txt");
l.log(ERROR, "error message");
return 0;
}
The full example is in the example/
directory. You can find more useful functions from log.cc
The following examples use l
as the default logger name.
You can use the log()
function in this way, just like printf()
:
l.log(WARNING, "%d", 1);
Important
Don't forget to set the log level (which is the first argument of the log()
function).
Tip
There are also many useful functions in log.cc. You can view the Wiki page for more info.