What is my purpose?
This commit is contained in:
commit
89db0bb24d
29 changed files with 1607 additions and 0 deletions
23
butterrobot/logging.py
Normal file
23
butterrobot/logging.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import logging
|
||||
|
||||
import structlog
|
||||
|
||||
from butterrobot.config import LOG_LEVEL, DEBUG
|
||||
|
||||
|
||||
logging.basicConfig(format="%(message)s", level=LOG_LEVEL)
|
||||
structlog.configure(
|
||||
processors=[
|
||||
structlog.stdlib.add_log_level,
|
||||
structlog.stdlib.add_logger_name,
|
||||
structlog.dev.set_exc_info,
|
||||
structlog.processors.StackInfoRenderer(),
|
||||
structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M.%S"),
|
||||
structlog.processors.format_exc_info,
|
||||
structlog.dev.ConsoleRenderer() if DEBUG else structlog.processors.JSONRenderer(),
|
||||
],
|
||||
context_class=dict,
|
||||
logger_factory=structlog.stdlib.LoggerFactory(),
|
||||
wrapper_class=structlog.BoundLogger,
|
||||
cache_logger_on_first_use=True,
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue