Generic python logging library.
- https://github.com/devstuff-io/spylogger
- https://docs.python.org/2/howto/logging.html#logging-levels
This installs spylogger only and will load the loggers with no external dependency requirements.
pip install spylogger
This installs spylogger, pygments, and pygments-json and loads the basic loggers along with pretty loggers.
pip install spylogger[pretty]
Name | Description | Default |
---|---|---|
SPY_LOG_LOGGER |
The configured logger name. Available loggers:
|
json-flat |
SPY_LOG_LEVEL | The python log level. See the python documentation | WARNING |
SPY_SHOW_META | Flag for showing the `__meta` output. | True |
SPY_JSON_LOG_KEYS |
A list of log record keys to put in the `__meta` section of the log message. Available Keys:
|
|
See the pygments documentation
Environment Variables
Name | Default |
---|---|
SPY_LOG_FORMATTER_DEBUG |
autumn |
SPY_LOG_FORMATTER_INFO |
monokai |
SPY_LOG_FORMATTER_WARNING |
fruity |
SPY_LOG_FORMATTER_ERROR |
default |
SPY_LOG_FORMATTER_CRITICAL |
vs |
Available styles
python -c "from pygments.styles import get_all_styles;print list(get_all_styles())"
from spylogger import get_logger
# get_logger(name=SPY_LOG_LOGGER, log_level=SPY_LOG_LEVEL)
logger = get_logger()
logger.info({'string': 'test Pretty info message.', 'int': 42, 'bool': True})
More examples are in example.py
See contributors section on GitHub.