Skip to content

Commit

Permalink
feat: settings add LOGGING_LEVEL parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
herve.le-bars committed Mar 6, 2024
1 parent 7c03cd9 commit 28cc9d5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ SLACK_URL=
# Folder where data are stored
DATA_FOLDER=/data

LOGGING_LEVEL=INFO


###############################################################################################
# DOCKER SPECIFIC VARIABLES
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ x-common-infos:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
LOGGING_LEVEL: ${LOGGING_LEVEL:-INFO}

services:
bloom:
Expand Down
1 change: 1 addition & 0 deletions src/bloom/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Settings(BaseSettings):
db_url:str = None
spire_token:str = None
data_folder:str=None
logging_level:str="INFO"

def __init__(self):
super().__init__(self)
Expand Down
3 changes: 2 additions & 1 deletion src/bloom/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from bloom.config import settings

logger = logging.getLogger("bloom")
formatter = logging.Formatter(
Expand All @@ -9,4 +10,4 @@
handler.setFormatter(formatter)
if not logger.handlers:
logger.addHandler(handler)
logger.setLevel(level="INFO")
logger.setLevel(level=settings.logging_level)

0 comments on commit 28cc9d5

Please sign in to comment.