Browse Source

Adding README

Lertsenem 5 years ago
parent
commit
822ac3e7ff
1 changed files with 25 additions and 0 deletions
  1. 25 0
      README.md

+ 25 - 0
README.md

@@ -0,0 +1,25 @@
1
+pycolog
2
+=======
3
+
4
+Simple logging formatter adding color codes to messages depending on log level.
5
+It's easy but I was tired of rewriting it on each project.
6
+
7
+Use it like this:
8
+
9
+```python
10
+from pycolog import ColoredFormatter
11
+
12
+# You can use it as a regular formatter, specifying fmt as you need.
13
+log_formatter = ColoredFormatter("%(asctime)s: %(message)s" 
14
+
15
+# You also may chose a custom color set. Any level not specified will be
16
+# printed with regular color.
17
+log_formatter2 = ColoredFormatter( "%(message)s",
18
+                                   colors = {
19
+                                       "WARNING" : ColoredFormatter.BLUE,
20
+                                       "ERROR"   : ColoredFormatter.YELLOW,
21
+                                       } )
22
+```
23
+
24
+The code is really easy. Take a look if you want more details (all available
25
+colors and such).