Added optional DEBUG logging (0.29.0)
This commit is contained in:
parent
6c2dcc7f90
commit
95728a3376
2 changed files with 35 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ from linspector.environment import Environment
|
||||||
from linspector.linspector import Linspector
|
from linspector.linspector import Linspector
|
||||||
from linspector.monitors import Monitors
|
from linspector.monitors import Monitors
|
||||||
|
|
||||||
__version__ = '0.28.4'
|
__version__ = '0.29.0'
|
||||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||||
|
|
||||||
sys.stderr = open('/dev/null', 'w')
|
sys.stderr = open('/dev/null', 'w')
|
||||||
|
|
@ -97,17 +97,39 @@ def linspector():
|
||||||
log.add(configuration.get_option('linspector', 'logfile'), backtrace=True, diagnose=True, enqueue=True,
|
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)
|
format=logfile_format, level=logfile_level, retention=int(logfile_count), rotation=logfile_size)
|
||||||
|
|
||||||
|
default_debug_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', 'debug_logfile'):
|
||||||
|
debug_logfile_count = '10'
|
||||||
|
if configuration.get_option('linspector', 'debug_logfile_count'):
|
||||||
|
debug_logfile_count = configuration.get_option('linspector', 'debug_logfile_count')
|
||||||
|
|
||||||
|
debug_logfile_format = default_debug_log_format
|
||||||
|
if configuration.get_option('linspector', 'error_logfile_format'):
|
||||||
|
debug_logfile_format = configuration.get_option('linspector', 'debug_logfile_format')
|
||||||
|
|
||||||
|
debug_logfile_level = 'DEBUG'
|
||||||
|
|
||||||
|
debug_logfile_size = '1MB'
|
||||||
|
if configuration.get_option('linspector', 'debug_logfile_size'):
|
||||||
|
debug_logfile_size = configuration.get_option('linspector', 'debug_logfile_size')
|
||||||
|
|
||||||
|
log.add(configuration.get_option('linspector', 'debug_logfile'), backtrace=True, diagnose=True,
|
||||||
|
enqueue=True, format=debug_logfile_format, level=debug_logfile_level,
|
||||||
|
retention=int(debug_logfile_count), rotation=debug_logfile_size)
|
||||||
|
|
||||||
default_error_log_format = 'timestamp={time:YYYY-MM-DD HH:mm:ss.SSSSSS ZZ} uptime={elapsed} level={level} ' \
|
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}'
|
'name=linspector exec={name}:{function} line={line} {message}'
|
||||||
|
|
||||||
if configuration.get_option('linspector', 'error_logfile'):
|
if configuration.get_option('linspector', 'error_logfile'):
|
||||||
error_logfile_count = '10'
|
error_logfile_count = '10'
|
||||||
if configuration.get_option('linspector', 'error_logfile_count'):
|
if configuration.get_option('linspector', 'error_logfile_count'):
|
||||||
logfile_count = configuration.get_option('linspector', 'error_logfile_count')
|
error_logfile_count = configuration.get_option('linspector', 'error_logfile_count')
|
||||||
|
|
||||||
error_logfile_format = default_error_log_format
|
error_logfile_format = default_error_log_format
|
||||||
if configuration.get_option('linspector', 'error_logfile_format'):
|
if configuration.get_option('linspector', 'error_logfile_format'):
|
||||||
logfile_format = configuration.get_option('linspector', 'error_logfile_format')
|
error_logfile_format = configuration.get_option('linspector', 'error_logfile_format')
|
||||||
|
|
||||||
error_logfile_level = 'ERROR'
|
error_logfile_level = 'ERROR'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,16 @@ error_logfile_format = [{time:YYYY-MM-DD HH:mm:ss.SSSSSS ZZ}] [{elapsed}] [{leve
|
||||||
; max error logfile size (default: 1MB)
|
; max error logfile size (default: 1MB)
|
||||||
error_logfile_size = 5MB
|
error_logfile_size = 5MB
|
||||||
|
|
||||||
|
; debug logfile (do not set to disable debug logging)
|
||||||
|
; this should never be enabled in a production environment but in case of errors it can be helpful to figure out what is wrong
|
||||||
|
debug_logfile = /home/hanez/code/linspector/linspector/log/debug.log
|
||||||
|
; number of debug logfiles to keep (default: 10)
|
||||||
|
debug_logfile_count = 3
|
||||||
|
; debug logfile format. this overrides the default configured in the code
|
||||||
|
debug_logfile_format = [{time:YYYY-MM-DD HH:mm:ss.SSSSSS ZZ}] [{elapsed}] [{level}] [linspector] [{name}:{function}:{line}]: {message}
|
||||||
|
; max debug logfile size (default: 1MB)
|
||||||
|
debug_logfile_size = 15MB
|
||||||
|
|
||||||
notifications =
|
notifications =
|
||||||
|
|
||||||
plugins =
|
plugins =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue