Skip to content

Commit

Permalink
feat: add log level config
Browse files Browse the repository at this point in the history
  • Loading branch information
deryrahman committed Apr 23, 2024
1 parent 6c96b67 commit b084279
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion task/bq2bq/executor/bumblebee/log.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import sys
import logging
import os

def get_log_level():
log_level = str(os.environ.get("LOG_LEVEL", default="INFO")).upper()
log_level = log_level if log_level in logging._nameToLevel else "INFO"
return logging._nameToLevel.get(log_level)

def get_logger(name: str):
logger = logging.getLogger(name)
logformat = "[%(asctime)s] %(levelname)s:%(name)s: %(message)s"
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout,
logging.basicConfig(level=get_log_l, stream=sys.stdout,
format=logformat, datefmt="%Y-%m-%d %H:%M:%S")

return logger

0 comments on commit b084279

Please sign in to comment.