aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2020-10-19 09:44:01 +0200
committerNao Pross <np@0hm.ch>2020-10-19 09:45:53 +0200
commit31a984f943b38e67fa185e268ecf9c46e35791c2 (patch)
tree18f6b11040120bc0e553f771f36958b16a48da06
parentAdd LICENSE and version (diff)
downloadMuddle-31a984f943b38e67fa185e268ecf9c46e35791c2.tar.gz
Muddle-31a984f943b38e67fa185e268ecf9c46e35791c2.zip
Color logs
-rw-r--r--muddle.py16
-rw-r--r--requirements.txt1
2 files changed, 15 insertions, 2 deletions
diff --git a/muddle.py b/muddle.py
index f763280..81bc683 100644
--- a/muddle.py
+++ b/muddle.py
@@ -3,6 +3,7 @@
import argparse
import configparser
import logging
+import colorlog
import os
import sys
@@ -33,9 +34,20 @@ log = logging.getLogger("muddle")
log.setLevel(logging.DEBUG)
if args.verbose:
- cli_handler = logging.StreamHandler()
+ cli_handler = colorlog.StreamHandler()
cli_handler.setLevel(logging.DEBUG)
- cli_handler.setFormatter(logformatter)
+ cli_formatter = colorlog.ColoredFormatter("%(name)-13s - %(log_color)s%(levelname)-8s%(reset)s: %(message)s",
+ datefmt=None,
+ reset=True,
+ log_colors={
+ 'DEBUG': 'cyan',
+ 'INFO': 'green',
+ 'WARNING': 'yellow',
+ 'ERROR': 'red',
+ 'CRITICAL': 'red,bg_white',
+ }
+ )
+ cli_handler.setFormatter(cli_formatter)
log.addHandler(cli_handler)
# C O N F I G S A N D L O G S
diff --git a/requirements.txt b/requirements.txt
index 0d9c554..da54388 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,6 @@
certifi==2020.6.20
chardet==3.0.4
+colorlog==4.4.0
idna==2.10
PyQt5==5.15.1
PyQt5-sip==12.8.1