summaryrefslogtreecommitdiff
path: root/raphodo/iplogging.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-02 06:51:13 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-02 06:51:13 +0200
commitc5fc6c6030d7d9d1b2af3d5165bebed3decd741b (patch)
treedfacccc9ae0747e53e53e5388b2ecd0623e040c3 /raphodo/iplogging.py
parent77dd64c0757c0191b276e65c24ee9874959790c8 (diff)
New upstream version 0.9.4upstream/0.9.4
Diffstat (limited to 'raphodo/iplogging.py')
-rw-r--r--raphodo/iplogging.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/raphodo/iplogging.py b/raphodo/iplogging.py
index e58dd3d..d035a70 100644
--- a/raphodo/iplogging.py
+++ b/raphodo/iplogging.py
@@ -81,9 +81,11 @@ def full_log_file_path():
log_file = os.path.join(os.path.expanduser('~'), logfile_name)
return log_file
+
def setup_main_process_logging(logging_level: int) -> logging.Logger:
"""
Setup logging at the module level
+
:param log_file_path: path where log file should be stored
:param logging_level: logging module's logging level for console output
:return: default logging object
@@ -92,18 +94,20 @@ def setup_main_process_logging(logging_level: int) -> logging.Logger:
log_file = full_log_file_path()
logger = logging.getLogger()
max_bytes = 1024 * 1024 # 1 MB
- filehandler = RotatingGzipFileHandler(log_file, maxBytes=max_bytes, backupCount=5)
+ filehandler = RotatingGzipFileHandler(log_file, maxBytes=max_bytes, backupCount=10)
filehandler.setLevel(logging.DEBUG)
filehandler.setFormatter(logging.Formatter(file_logging_format, logging_date_format))
logger.addHandler(filehandler)
logger.setLevel(logging.DEBUG)
consolehandler = logging.StreamHandler()
+ consolehandler.set_name('console')
if not use_colorlog:
consolehandler.setFormatter(logging.Formatter(logging_format))
else:
- consolehandler.setFormatter(colorlog.ColoredFormatter(fmt=colored_logging_format,
- log_colors=log_colors))
+ consolehandler.setFormatter(
+ colorlog.ColoredFormatter(fmt=colored_logging_format, log_colors=log_colors)
+ )
consolehandler.setLevel(logging_level)
logger.addHandler(consolehandler)
return logger