Python logger helper to log in json and redirect flask logs
Project description
zonar_ds_logger
======
Overview
------
A logger class that initializes a logger and logs in json when specified.
It also redirects flask logs so it doesn’t always show up as ERROR
Usage
------
```python
from zonar_ds_logger.logger import logger
logger.initialize("evan-test", "info", False)
log = logger.get_logger()
log.debug("debug")
log.info("info")
log.warning("warning")
log.error("error")
```
Arguments
------
Parameters that can be passed into logger.initialize are as follows:
- name (str): Name of the logger
- log_level (str): Lowest log level to log. Default is "debug". Options are "debug", "info", "warning", "error"
- json_logging (bool): Whether to log in json or not. Options that evaluate to true are ("true", "t", "1", "y", "yes")
Default converts value in JSON_LOGGING env var to bool if set else True
======
Overview
------
A logger class that initializes a logger and logs in json when specified.
It also redirects flask logs so it doesn’t always show up as ERROR
Usage
------
```python
from zonar_ds_logger.logger import logger
logger.initialize("evan-test", "info", False)
log = logger.get_logger()
log.debug("debug")
log.info("info")
log.warning("warning")
log.error("error")
```
Arguments
------
Parameters that can be passed into logger.initialize are as follows:
- name (str): Name of the logger
- log_level (str): Lowest log level to log. Default is "debug". Options are "debug", "info", "warning", "error"
- json_logging (bool): Whether to log in json or not. Options that evaluate to true are ("true", "t", "1", "y", "yes")
Default converts value in JSON_LOGGING env var to bool if set else True
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
zonar_ds_logger-0.0.2.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for zonar_ds_logger-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ca9bbee0a98e5655b4392c7eeda99cab9e8581298841b99c7693cd6d2aa4a58 |
|
MD5 | 03fd9da239845eb72e4e52a2ef7d2e94 |
|
BLAKE2b-256 | f60bc0ebcb1b474d26966c6f01c488c89f09304ddc713e40e50bd18dfffc93d5 |