Added more customizable error logging and bug fixes! (0.28.0)

This commit is contained in:
Johannes Findeisen 2023-09-02 19:54:46 +02:00
commit c5fdd1cc4a
5 changed files with 48 additions and 23 deletions

View file

@ -20,7 +20,7 @@ from linspector.environment import Environment
from linspector.linspector import Linspector
from linspector.monitors import Monitors
__version__ = '0.27.1'
__version__ = '0.28.0'
__author__ = 'Johannes Findeisen <you@hanez.org>'
sys.stderr = open('/dev/null', 'w')
@ -68,7 +68,7 @@ def linspector():
log.remove()
default_log_format = 'timestamp={time:YYYY-MM-DD HH:mm:ss.SSSSSS ZZ} uptime={elapsed} level={level} ' \
'name=linspector exec={name}:{function} line={line} {message}'
'name=linspector {message}'
if configuration.get_option('linspector', 'logfile'):
logfile_count = '10'
@ -90,10 +90,27 @@ def linspector():
log.add(configuration.get_option('linspector', 'logfile'), backtrace=True, diagnose=True, enqueue=True,
format=logfile_format, level=logfile_level, retention=int(logfile_count), rotation=logfile_size)
if configuration.get_option('linspector', 'logfile_error'):
log.add(configuration.get_option('linspector', 'logfile_error'), backtrace=True, diagnose=True,
enqueue=True, format=logfile_format, level='ERROR', retention=int(logfile_count),
rotation=logfile_size)
default_error_log_format = 'timestamp={time:YYYY-MM-DD HH:mm:ss.SSSSSS ZZ} uptime={elapsed} level={level} ' \
'name=linspector exec={name}:{function} line={line} {message}'
if configuration.get_option('linspector', 'error_logfile'):
error_logfile_count = '10'
if configuration.get_option('linspector', 'error_logfile_count'):
logfile_count = configuration.get_option('linspector', 'error_logfile_count')
error_logfile_format = default_error_log_format
if configuration.get_option('linspector', 'error_logfile_format'):
logfile_format = configuration.get_option('linspector', 'error_logfile_format')
error_logfile_level = 'ERROR'
error_logfile_size = '1MB'
if configuration.get_option('linspector', 'error_logfile_size'):
error_logfile_size = configuration.get_option('linspector', 'error_logfile_size')
log.add(configuration.get_option('linspector', 'error_logfile'), backtrace=True, diagnose=True,
enqueue=True, format=error_logfile_format, level=error_logfile_level,
retention=int(error_logfile_count), rotation=error_logfile_size)
environment = Environment(log)