Skip to content

Commit 2134420

Browse files
committed
Added usage instructions in the README
1 parent 3ab7559 commit 2134420

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,52 @@ pip install friendlylog
2020

2121
Usage
2222
-----
23-
TODO
23+
24+
1. Simple Logger
25+
26+
```python
27+
import logging
28+
29+
from friendlylog import simple_logger as log
30+
31+
# Anything above or including DEBUG will be logged.
32+
log.setLevel(logging.DEBUG)
33+
34+
log.debug("debug message")
35+
log.info("info message")
36+
log.warning("warning message")
37+
log.error("error message")
38+
log.critical("critical message")
39+
```
40+
41+
Will result in the following logs (`test.py` is the name of the file):
42+
```
43+
[07-Oct-19 11:06:06.107 in test.py - <module>: 3] DEBUG: debug message
44+
[07-Oct-19 11:06:06.107 in test.py - <module>: 4] INFO: info message
45+
[07-Oct-19 11:06:06.107 in test.py - <module>: 5] WARNING: warning message
46+
[07-Oct-19 11:06:06.107 in test.py - <module>: 6] ERROR: error message
47+
[07-Oct-19 11:06:06.107 in test.py - <module>: 7] CRITICAL: critical message
48+
```
49+
50+
2. Colored Logger
51+
52+
```python
53+
import logging
54+
55+
from friendlylog import colored_logger as log
56+
57+
# Anything above or including DEBUG will be logged.
58+
log.setLevel(logging.DEBUG)
59+
60+
log.debug("debug message")
61+
log.info("info message")
62+
log.warning("warning message")
63+
log.error("error message")
64+
log.critical("critical message")
65+
```
66+
67+
Will result in the following logs:
68+
![Colored log](https://github.com/SebiSebi/friendlylog/blob/master/images/colored_log.png)
2469

2570

2671
Contributing

images/colored_log.png

30.4 KB
Loading

0 commit comments

Comments
 (0)