blob: 6f9d0f968b39bcdc8718736e246d31d51671120b (
plain)
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
|
# GeneNetwork logger
#
# The standard python logging module is very good. This logger adds a
# few facilities on top of that. Main one being that it picks up
# settings for log levels (global and by module) and (potentially)
# offers some fine grained log levels for the standard levels.
#
# All behaviour is defined here. Global settings (defined in
# default_settings.py).
import logging
from utility.tools import LOG_LEVEL
print("Set global log level to "+LOG_LEVEL)
log_level = getattr(logging, LOG_LEVEL.upper())
logging.basicConfig(level=log_level)
# Get the module logger. You can override log levels at the
# module level
def getLogger(name, level = None):
logger = logging.getLogger(name)
if level:
logger.setLevel(level)
return logger
|