forked from raystack/transformers
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c96b67
commit b084279
Showing
1 changed file
with
6 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |