Simple logging configuration for simultaneous file and shell logging
Project description
logging configurator
Simple configurator for the python logging package that allows simultaneous file and shell logging
installation
There are no PyPI releases. Neither are they planned.
manual
For manual installation with pip directly from this GitHub repository simply open a terminal and type
pip install git+ssh://git@github.com/rlipperts/logger.git
setup.py
To automatically install the logging configurator with your python package include these lines in your setup.py
install_requires = [
'logging-configurator @ git+ssh://git@github.com/rlipperts/logger.git@master#egg=logging-configurator-0.0.2',
],
Make sure you update the version in the egg=logging-configurator-...
'portion to the correct version specified in the logging-configurators setup.py. This might not work if you plan on publishing your package on PyPI.
usage
Import the package and the default python logging
import log_configurator
import logging
Configure python logging
logging_configurator.setup_root_logger()
Create a logging instance in your module as usual and log with it
logger = logging.getLogger(__name__)
logger.info('Log Horizon')
buffer initial output
If you need more complex argument parsing before you can configure the logger you can buffer it and have it logged once you configure your logger.
initial_log = logging_configurator.buffer_log()
logger = logging.getLogger(__name__)
logger.info('Early log information')
# <your setup code goes here>
logging_configurator.setup_root_logger()
logger.debug(initial_log.getvalue())
The early log output currently can only be logged with one severity level.
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
Hashes for log_configurator-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1c3f056ec7d562bd503fb27045d57de2e5b00f88547c85ebdcaa52593b5142e |
|
MD5 | 834a6344f41c33b22b8d9e1cd1a4fecd |
|
BLAKE2b-256 | 0361d12bebd3811ee2b5bfc2324f6095670ed1e90199882420acc3684fa19e53 |