Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

log-configurator-0.0.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

log_configurator-0.0.2-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page