auth_ids = set(map(int, main_cfg["auth IDs"].split()))
bot_user = main_cfg["bot user"]
enforcing = main_cfg.getboolean("enforcing")
+
+raw_log_level = main_cfg.get("log level", "WARNING")
+try:
+ log_level = int(raw_log_level)
+except ValueError:
+ log_level = raw_log_level
+
reorder_buffer_time = dt.timedelta(seconds = main_cfg.getfloat("reorder buffer time"))
request_queue_limit = main_cfg.getint("request queue limit")
thread_id = main_cfg["thread ID"]
logger = getLogger(__package__)
-logger.setLevel(logging.DEBUG)
+logger.setLevel(logging.NOTSET - 1) # NOTSET means inherit from parent; we use handlers to filter
handler = StreamHandler(stdout)
-handler.setLevel(logging.WARNING)
+handler.setLevel(log_level)
handler.setFormatter(logging.Formatter("{asctime:23}: {name:17} {levelname:8}: {message}", style = "{"))
logger.addHandler(handler)
-if _DEBUG_LOG_PATH:
+if _DEBUG_LOG_PATH: # TODO remove this ad hoc setup
debug_handler = FileHandler(_DEBUG_LOG_PATH, mode = "w")
debug_handler.setLevel(logging.DEBUG)
debug_handler.setFormatter(logging.Formatter("{asctime:23}: {name:17} {levelname:8}: {message}", style = "{"))