2019-04-25 21:41:26 +02:00
|
|
|
import logging
|
|
|
|
|
2019-04-25 21:01:53 +02:00
|
|
|
from .ffm import *
|
2018-11-26 14:39:06 +01:00
|
|
|
from .ilias import *
|
2019-04-25 21:15:36 +02:00
|
|
|
from .norbert import *
|
2018-11-24 09:27:33 +01:00
|
|
|
from .utils import *
|
2018-11-20 06:55:41 +01:00
|
|
|
|
2019-04-25 21:41:26 +02:00
|
|
|
__all__ = ["STYLE", "FORMAT", "DATE_FORMAT", "FORMATTER", "enable_logging"]
|
|
|
|
|
2019-04-25 21:01:53 +02:00
|
|
|
__all__ += ffm.__all__
|
2019-04-25 20:52:48 +02:00
|
|
|
__all__ += ilias.__all__
|
2019-04-25 21:15:36 +02:00
|
|
|
__all__ += norbert.__all__
|
2019-04-25 20:52:48 +02:00
|
|
|
__all__ += utils.__all__
|
2018-11-20 06:55:41 +01:00
|
|
|
|
2019-04-25 21:41:26 +02:00
|
|
|
STYLE = "{"
|
|
|
|
FORMAT = "[{levelname:<7}] {message}"
|
|
|
|
DATE_FORMAT = "%F %T"
|
|
|
|
|
|
|
|
FORMATTER = logging.Formatter(
|
|
|
|
fmt=FORMAT,
|
|
|
|
datefmt=DATE_FORMAT,
|
|
|
|
style=STYLE,
|
|
|
|
)
|
|
|
|
|
|
|
|
def enable_logging(name="PFERD", level=logging.INFO):
|
|
|
|
handler = logging.StreamHandler()
|
|
|
|
handler.setFormatter(FORMATTER)
|
|
|
|
|
|
|
|
logger = logging.getLogger(name)
|
|
|
|
logger.setLevel(level)
|
|
|
|
logger.addHandler(handler)
|
|
|
|
|
|
|
|
# This should be logged by our own handler, and not the root logger's
|
|
|
|
# default handler, so we don't pass it on to the root logger.
|
|
|
|
logger.propagate = False
|