mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 16:28:16 +00:00
Make logging level configurable with an ENV var (#102)
This commit is contained in:
parent
8230f8560b
commit
68b2eb1e41
2 changed files with 7 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
logging.basicConfig(level="INFO" if env.environment != "production" else "WARNING")
|
||||
logging.basicConfig(level=env.log_level)
|
||||
|
||||
|
||||
@contextlib.asynccontextmanager
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
import os
|
||||
from typing import Literal
|
||||
|
||||
|
|
@ -24,6 +25,11 @@ class Environment:
|
|||
self.site_api_key = os.environ.get("SITE_API_KEY", "unset")
|
||||
|
||||
self.environment = os.environ.get("ENVIRONMENT", "development")
|
||||
self.log_level = os.environ.get(
|
||||
"LOG_LEVEL",
|
||||
logging.INFO if self.environment == "production" else logging.WARNING,
|
||||
)
|
||||
|
||||
self.slack_help_channel = os.environ.get("SLACK_HELP_CHANNEL", "unset")
|
||||
self.slack_ticket_channel = os.environ.get("SLACK_TICKET_CHANNEL", "unset")
|
||||
self.slack_bts_channel = os.environ.get("SLACK_BTS_CHANNEL", "unset")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue