adding latest changes to read-from-config

This commit is contained in:
2019-12-05 03:07:35 +00:00
parent 3af8d00661
commit e0b77d7150
4 changed files with 49 additions and 33 deletions

View File

@@ -32,11 +32,11 @@ if CONFIG.logging_path:
if CONFIG.logging_path[-1] == '/'
else f'/{__header__}.log'
)
# Set default log file options
# Set default log file options
set_config(CONFIG, 'logging.backup_count', 3, int)
set_config(CONFIG, 'logging.rotate_bytes', 512000, int)
# Add to file handler
# Configure file handler
loghandler_file = RotatingFileHandler(
os.path.expanduser(CONFIG.logging_path),
'a',
@@ -44,20 +44,16 @@ if CONFIG.logging_path:
CONFIG.logging_backup_count,
)
# Set file formatter
# Add to file formatter
loghandler_file.setFormatter(logging.Formatter(CONFIG.logging_format))
logger.addHandler(loghandler_file)
# Set stdout formatter
# Configure and add to stdout formatter
loghandler_sys.setFormatter(logging.Formatter(CONFIG.logging_format))
logger.addHandler(loghandler_sys)
logger.setLevel(CONFIG.logging_level)
# Load Slack environment variables
set_config(CONFIG, 'slack.client_id')
set_config(CONFIG, 'slack.client_secret')
set_config(CONFIG, 'slack.signing_secret')
# Load module environment variables
# Print logged messages