config-logger: Configurable and flexible logger for your python applications
Build Status
Project details
Description
The config-logger package is a basic configurable logger. It reads the configuration data for the logging from an external YAML, JSON file or from a given python dictionary and validates it. The contents of this dictionary are described in Configuration dictionary schema. This package is currently tested on Python 2.7.
Installation
pip install config-logger
or
download the latest release and run
python setup.py install
Usage
Configured from external .yaml or .json file
#logging.yaml contains the configuration data which defines the logging in your project
from config_logger import Logger
logger = Logger(name='my_logger', cfg_path='/path/to/logging.yaml')
logger.info("This will be written in a file called info.log")
Console Output
2017-01-31 12:20:32,693 - my_logger - INFO - This will be written in a file called info.log
Configured from dictionary
log_config = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'basic': {
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'basic',
'level': 'WARNING',
'stream': 'ext://sys.stdout'
}
'root': {
'handlers': ['console'],
'level': 'WARNING'
}
}
from config_logger import Logger
logger = Logger(name='my_logger', default_conf=log_config)
logger.warning("This will be written in a file called warning.log")
Console Output
2017-01-31 13:12:56,002 - my_logger - WARNING - This will be written in a file called warning.log
Note: You can find sample of logging configuration files supported by config-logger in this repo.
License
This project is licensed under the MIT license.
Metadata
Release files for config-logger 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| config-logger-1.1.1.tar.gz | 6.3 kB | Without provenance | Details for config-logger-1.1.1.tar.gz |
Release files / config-logger-1.1.1.tar.gz
| Download URL | config-logger-1.1.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37d28f9d198b991044593e9e68667eb7828aa9371659f29ac6591d7636bb6d90
|
|
BLAKE2b-256 checksum How to use checksums |
e21b6e0cf9185fc2ccab342924d26e5b41c7a985e9078ee0a5e66ef9b1bce617
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5rc1
|
Security for config-logger 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.