-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
Description
run_locally allows toggling a python std lib logger
jobflow/src/jobflow/managers/local.py
Line 18 in 947072a
| log: bool = True, |
whose settings are hard-coded in initialize_logger. would be great if run_locally accepted a list of custom handlers. we run DFT in containers on cloud infra and would like to send our logs to ElasticSearch which currently seems to require a lot of hackery
jobflow/src/jobflow/utils/log.py
Lines 5 to 28 in 947072a
| def initialize_logger(level: int = logging.INFO) -> logging.Logger: | |
| """Initialize the default logger. | |
| Parameters | |
| ---------- | |
| level | |
| The log level. | |
| Returns | |
| ------- | |
| Logger | |
| A logging instance with customized formatter and handlers. | |
| """ | |
| import sys | |
| log = logging.getLogger("jobflow") | |
| log.setLevel(level) | |
| log.handlers = [] # reset logging handlers if they already exist | |
| fmt = logging.Formatter("%(asctime)s %(levelname)s %(message)s") | |
| screen_handler = logging.StreamHandler(stream=sys.stdout) | |
| screen_handler.setFormatter(fmt) | |
| log.addHandler(screen_handler) |
Reactions are currently unavailable