Global Logger

Global Logger instance used by spooq.

Example

>>> import logging
>>> logga = logging.getLogger("spooq")
<logging.Logger at 0x7f5dc8eb2890>
>>> logga.info("Hello World")
[spooq] 2020-03-21 23:55:48,253 INFO logging_example::<module>::4: Hello World
initialize()[source]

Initializes the global logger for Spooq with pre-defined levels for stdout and stderr. No input parameters are needed, as the configuration is received via get_logging_level().

Note

The output format is defined as:
“[%(name)s] %(asctime)s %(levelname)s %(module)s::%(funcName)s::%(lineno)d: %(message)s”
For example “[spooq] 2020-03-11 15:40:59,313 DEBUG newest_by_group::__init__::53: group by columns: [u’user_id’]”

Warning

The root logger of python is also affected as it has to have a level at least as fine grained as the logger of Spooq, to be able to produce an output.

get_logging_level()[source]

Returns the logging level depending on the environment variable SPOOQ_ENV.

Note

If SPOOQ_ENV is
  • dev -> “DEBUG”

  • test -> “ERROR”

  • something else -> “INFO”

Returns

Logging level

Return type

str