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

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.0.0.tar.gz (5.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: config-logger-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for config-logger-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e7e70bb36303eb4972660bdca3c0adf0e9daf5d5edda289accdda7a06fe59e0e
MD5 183bd41b8950c146dac20704b94d6e94
BLAKE2b-256 f759719fa548152aa3c8604ad997f58566411dc114ddbd3de0024fe9f56ea62e

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.1

1 file

1.1.0

2 files

1.0.2

1 file

1.0.1

1 file

This release

1.0.0 This release

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