forked from NVIDIA/VideoProcessingFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
26 lines (18 loc) · 678 Bytes
/
utils.py
File metadata and controls
26 lines (18 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sys
import logging
SERVICE_LOGGING_FORMAT = (
"[{filename:s}][{funcName:s}:{lineno:d}]" + "[{levelname:s}] {message:s}"
)
SERVICE_LOGGING_STREAM = sys.stdout
def get_logger(logger_name, log_level="info"):
SERVICE_LOGGING_LEVEL = getattr(logging, log_level.upper(), None)
logger = logging.getLogger(logger_name)
logger.setLevel(SERVICE_LOGGING_LEVEL)
ch = logging.StreamHandler(SERVICE_LOGGING_STREAM)
formatter = logging.Formatter(SERVICE_LOGGING_FORMAT, style="{")
ch.setFormatter(formatter)
ch.setLevel(SERVICE_LOGGING_LEVEL)
logger.addHandler(ch)
logger.propagate = False
return logger
logger = get_logger(__file__)