Reverted some of the last commit. Megabytes make sense for log_file_size.

This commit is contained in:
Johannes Findeisen 2022-10-06 23:20:37 +02:00
commit 7806511884
2 changed files with 14 additions and 7 deletions

View file

@ -37,7 +37,7 @@ logger = logging.getLogger('linspector')
# i currently only increase the 3rd number because the goal is that 0.19.* will become the first
# stable version.
__version__ = '0.19.39.dev1'
__version__ = '0.19.40.dev1'
__author__ = 'Johannes Findeisen <you@hanez.org>'
@ -111,10 +111,14 @@ def main():
logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s')
if configuration.get_option('linspector', 'log_file_size'):
log_file_size = int(configuration.get_option('linspector', 'log_file_size'))
log_file_size_mb = int(configuration.get_option('linspector', 'log_file_size'))
log_file_size_bytes = int(log_file_size_mb * 1000000)
elif configuration.get_option('linspector', 'log_file_size_bytes'):
log_file_size_bytes = int(configuration.get_option('linspector',
'log_file_size_bytes'))
else:
# default log file size is 10000000 bytes (10MiB)
log_file_size = int(10000000)
# default log file size is 10000000 bytes
log_file_size_bytes = int(10000000)
if configuration.get_option('linspector', 'log_file_count'):
log_file_count = int(configuration.get_option('linspector', 'log_file_count'))
@ -123,7 +127,7 @@ def main():
log_file_count = 1
log_file_handler = logging.handlers.RotatingFileHandler(log_file,
maxBytes=log_file_size,
maxBytes=log_file_size_bytes,
backupCount=log_file_count)
log_file_handler.setFormatter(log_file_formatter)