Skip to main content

Build Status

Travis-CI build status Code Coverage Code Health

Project details

License Pypi Version

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.

Download files

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

Source Distribution

config-logger-1.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

config_logger-1.1.0-py3.6.egg (12.0 kB view details)

Uploaded Egg

File details

Details for the file config-logger-1.1.0.tar.gz.

File metadata

  • Download URL: config-logger-1.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5rc1

File hashes

Hashes for config-logger-1.1.0.tar.gz
Algorithm Hash digest
SHA256 82cfce387b53a742f5df902990e6e0505477d1a4de96faa58cc0562e34bc0189
MD5 10e3ef87cc8029678ba797fd9c707680
BLAKE2b-256 640b2b9d66018af522449013d0d1e7d968c7d2293048b3140b6cef608e784373

See more details on using hashes here.

File details

Details for the file config_logger-1.1.0-py3.6.egg.

File metadata

  • Download URL: config_logger-1.1.0-py3.6.egg
  • Upload date:
  • Size: 12.0 kB
  • Tags: Egg
  • Uploaded using 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

File hashes

Hashes for config_logger-1.1.0-py3.6.egg
Algorithm Hash digest
SHA256 d6c5380f1545140f5e13a579cef488ac5d12cba1b71c0484aa35c99c52796559
MD5 8ffa0f7c6e983050785edd9f4c7dd92a
BLAKE2b-256 e7250280972208c65c9e6f7241ac4782d4291aac7f11c89f5ba18e431ae73fb6

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.1

1 file

This release

1.1.0 This release

2 files

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page