Skip to content

Commit 2e7757f

Browse files
committed
Add README.md
1 parent b62d9d0 commit 2e7757f

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
SimpleLogger
2+
============
3+
4+
Looking for a simple logger for C++ ? SimpleLogger might be for you.
5+
6+
# Features
7+
8+
* Based on RAII
9+
* Configurable level symbols
10+
* Date / time
11+
* Logging levels: Trace, Debug, Info, Warning, Error, Fatal
12+
* Log to file and/or console
13+
* Very easy to use
14+
15+
# Installation
16+
17+
Just add `src/logger.hpp` and `src/logger.cpp` to your project and start using it!
18+
19+
# Examples
20+
21+
## Log to console
22+
23+
```
24+
using juzzlin::L;
25+
26+
L().info() << "Something happened";
27+
```
28+
29+
Outputs something like this:
30+
31+
`[Sat Oct 13 22:38:42 2018] I: Something happened`
32+
33+
## Log to file and console
34+
35+
```
36+
using juzzlin::L;
37+
38+
L::init("/tmp/myLog.txt");
39+
40+
L().info() << "Something happened";
41+
```
42+
43+
## Log only to file
44+
45+
```
46+
using juzzlin::L;
47+
48+
L::init("/tmp/myLog.txt");
49+
L::enableEchoMode(false);
50+
51+
L().info() << "Something happened";
52+
```
53+
54+
## Set logging level
55+
56+
```
57+
using juzzlin::L;
58+
59+
L::setLoggingLevel(L::Level::Debug);
60+
61+
L().info() << "Something happened";
62+
L().debug() << "A debug thing happened";
63+
```
64+
65+
Outputs something like this:
66+
67+
`[Sat Oct 13 22:38:42 2018] I: Something happened`
68+
69+
`[Sat Oct 13 22:38:42 2018] D: A debug thing happened`
70+
71+
## Set custom level symbols
72+
73+
```
74+
using juzzlin::L;
75+
76+
L::setLoggingLevel(L::Level::Debug);
77+
L::setLevelSymbol(L::Level::Debug, "<DEBUG>");
78+
79+
L().debug() << "A debug thing happened";
80+
```
81+
82+
Outputs something like this:
83+
84+
`[Sat Oct 13 22:38:42 2018] <DEBUG> A debug thing happened`
85+
86+
## Requirements
87+
88+
C++11
89+
90+
## Licence
91+
92+
MIT

0 commit comments

Comments
 (0)