diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-05-04 15:04:46 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-05-04 15:04:46 +0200 |
commit | 1ec64ccb178a4164ac204925c20c559d96508a9b (patch) | |
tree | a11105d202afa7fb54273ab9d74985bfe7098faa /labbot/logger.py | |
parent | 27b8241380d5f02fdcf00a832c281767ef258d9f (diff) | |
download | lab-bot-1ec64ccb178a4164ac204925c20c559d96508a9b.tar.gz lab-bot-1ec64ccb178a4164ac204925c20c559d96508a9b.zip |
add logging, offload addons into config, allow external addons
Diffstat (limited to 'labbot/logger.py')
-rw-r--r-- | labbot/logger.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/labbot/logger.py b/labbot/logger.py new file mode 100644 index 0000000..067bcac --- /dev/null +++ b/labbot/logger.py @@ -0,0 +1,19 @@ +import sys +import logging + +def init(level: int): + logger = logging.getLogger() + logger.setLevel(level) + + formatter = logging.Formatter( + "[{asctime}] [{levelname}] {name}: {message}", datefmt="%Y-%m-%d %H:%M:%S", style="{" + ) + + if not sys.stdout.closed: + stdout_handler = logging.StreamHandler(sys.stdout) + stdout_handler.setFormatter(formatter) + + logger.addHandler(stdout_handler) + + + logging.captureWarnings(True)
\ No newline at end of file |