Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
juzzlin committed Oct 13, 2018
1 parent b62d9d0 commit 2e7757f
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
SimpleLogger
============

Looking for a simple logger for C++ ? SimpleLogger might be for you.

# Features

* Based on RAII
* Configurable level symbols
* Date / time
* Logging levels: Trace, Debug, Info, Warning, Error, Fatal
* Log to file and/or console
* Very easy to use

# Installation

Just add `src/logger.hpp` and `src/logger.cpp` to your project and start using it!

# Examples

## Log to console

```
using juzzlin::L;
L().info() << "Something happened";
```

Outputs something like this:

`[Sat Oct 13 22:38:42 2018] I: Something happened`

## Log to file and console

```
using juzzlin::L;
L::init("/tmp/myLog.txt");
L().info() << "Something happened";
```

## Log only to file

```
using juzzlin::L;
L::init("/tmp/myLog.txt");
L::enableEchoMode(false);
L().info() << "Something happened";
```

## Set logging level

```
using juzzlin::L;
L::setLoggingLevel(L::Level::Debug);
L().info() << "Something happened";
L().debug() << "A debug thing happened";
```

Outputs something like this:

`[Sat Oct 13 22:38:42 2018] I: Something happened`

`[Sat Oct 13 22:38:42 2018] D: A debug thing happened`

## Set custom level symbols

```
using juzzlin::L;
L::setLoggingLevel(L::Level::Debug);
L::setLevelSymbol(L::Level::Debug, "<DEBUG>");
L().debug() << "A debug thing happened";
```

Outputs something like this:

`[Sat Oct 13 22:38:42 2018] <DEBUG> A debug thing happened`

## Requirements

C++11

## Licence

MIT

0 comments on commit 2e7757f

Please sign in to comment.