Python logging library
Project description
Generic python logging library.
Documentation: https://github.com/devstuff-io/spylogger
Installation
basic loggers
This installs spylogger only and will load the loggers with no external dependency requirements.
pip install spylogger
pretty loggers
This installs spylogger, pygments, and pygments-json and loads the basic loggers along with pretty loggers.
pip install spylogger[pretty]
Configuration
Environment Variables
Name |
Description |
Default |
---|---|---|
SPY_LOG_LOGGER |
The configured logger name. Available loggers:
|
json-flat |
SPY_LOG_LEVEL |
The python log level. See the docs |
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 python docs |
|
Pretty Formatter Styles
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())"
Usage
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file spylogger-1.2.2.tar.gz
.
File metadata
- Download URL: spylogger-1.2.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e270b7ac75008a08d036c5896e7f6a003e84e658537351d895955edc897b8513 |
|
MD5 | 89b248dedf7bd25545cc099aa6b6c982 |
|
BLAKE2b-256 | 0b643206bcbf48e12ddecfd3bf2bc6760bc6993669cca3377d286cafe1644a1b |
File details
Details for the file spylogger-1.2.2-py2-none-any.whl
.
File metadata
- Download URL: spylogger-1.2.2-py2-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7d0876f8508d2f0264af31414176aa4c7e69f84479dde8a9d1c824ebb05ad6a |
|
MD5 | bee6bfd8487639be6891bed95ff1cafe |
|
BLAKE2b-256 | e4abbfb04c9b09c6ced97734048baa273bf9eec706be70152c201dbada539926 |