Skip to content

Commit aa1125a

Browse files
committed
Update readme
Signed-off-by: Jan Losinski <[email protected]>
1 parent b983abe commit aa1125a

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
1-
# ArduinoLogging
2-
Log framework for Arduino supporting levels and handlers.
1+
# ArduinoSimpleLogging
2+
3+
Simple logging-framework for Arduino supporting levels and handlers.
4+
5+
It provides a static `Logger` instance that has static `Print` instances as members.
6+
These members are `debug`, `info`, `warning` and `error` and represent preconfigured log targets for the available log levels.
7+
8+
As these are `Print` instances, you can use them as drop-in-replacement for `Serial`.
9+
For example instead of `Serial.println("Hello")` you just write `Logger.debug.println("Hello")`.
10+
This will print the String `Hello` to all streams that are configured for `DEBUG`.
11+
12+
To configure a `Print` instance for a log level you simply add it as log handler.
13+
For example, to log all log messages to `Serial` you need to call:
14+
```cpp
15+
Logger.addHandler(Logger.DEBUG, Serial);
16+
```
17+
18+
Log levels are including.
19+
That means, that when you configure a handler for a certain level, you'll get everything up to this level.
20+
The available levels are: `ERROR`, `WARNING`, `INFO`, `DEBUG` with debug the highest level.
21+
So if you configure your Handler for `DEBUG`, you'll get messages for all levels.
22+
If you configure for `ERROR`, you'll get only error messages.

0 commit comments

Comments
 (0)