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++
- Host: GitHub
- URL: https://github.com/bmoscon/logger
- Owner: bmoscon
- License: other
- Created: 2014-03-15T12:09:06.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-08T22:03:57.000Z (almost 9 years ago)
- Last Synced: 2025-03-30T22:41:33.688Z (9 months ago)
- Language: C++
- Size: 11.7 KB
- Stars: 23
- Watchers: 4
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
##Simple, Lightweight Logging
[](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