An open API service indexing awesome lists of open source software.

https://github.com/bmoscon/logger

Simple, lightweight Logger written in C++
https://github.com/bmoscon/logger

Last synced: 8 months ago
JSON representation

Simple, lightweight Logger written in C++

Awesome Lists containing this project

README

          

##Simple, Lightweight Logging

[![License](https://img.shields.io/badge/license-XFree86-blue.svg)](LICENSE)

Usage:

Specify a filename when constructing:

```c++
Logger example("FILENAME");
```

Log lines will be written to this file. Use the << operator to
direct messages to the log stream and indicate the log level.
If the log level is omitted, it defaults to verbose:

```c++
example << ERROR << "Out of Memory!" << std::endl;
```

This line will look like this in the log file:

```
Sat Mar 15 08:06:58 2014 -- [ERROR] -- Out of Memory!
```

If you dont care for the formatting, change the code :)

You must end the line with an ```endl```. This tells the logger
to write the line and prepend the timestamp to the line
as well.

You can change the logging level like so:

```c++
example.set_level(VERBOSE);
```

The level defaults to ```VERBOSE``` is one is never set, and this can be changed via ```set_default_line_level```

Note: This library requires C++11 compiler support