1
0
mirror of https://github.com/Eyre-S/Coeur-Morny-Cono-python.git synced 2024-09-27 18:56:20 +08:00
Coeur-Morny-Cono-python/morny/log.py

22 lines
605 B
Python
Raw Normal View History

2023-05-11 20:40:32 +08:00
from pyssage.components.restrictions import RestrictionToLog, LevelRestriction
from pyssage.appender import ConsoleAppender
from pyssage.formatter import SimpleFormatter
from pyssage.log.log import levels
from pyssage.logger import Logger
restriction: RestrictionToLog = LevelRestriction(levels.INFO)
logger: Logger = Logger(ConsoleAppender(SimpleFormatter()))
logger.restrictions.append(restriction)
2023-05-06 23:44:08 +08:00
def set_debug_mode(mode: bool):
2023-05-11 20:40:32 +08:00
if mode:
restriction.min_level = levels.ALL
else:
restriction.min_level = levels.INFO
def is_debug_mode () -> bool:
return restriction.min_level < levels.INFO