Skip to main content

A logging toolkit

Project description

python-xlogs

logging toolkit

install

pip install xlogs

Usage

Use as decorator

from xlogs import log

if __name__ == '__main__':
    # config_file: the logging config template, use the default if None
    @log(log_file='./logs',config_file=None)
    def division():
        pass

load ini config file

from xlogs import Log
import logging

if __name__ == '__main__':
    Log(config_file= '/xxx.ini', log_file = '/xxx/')

    logging.info('Default load to root')
    info = logging.getLogger('root')
    info.info('write msg to test.log')

    info = logging.getLogger('test')
    info.info('write msg to test.log')

    info = logging.getLogger('info')
    info.info('write msg to info.log')

    error = logging.getLogger('error')
    error.error('write msg to error.log')

    # reload a new config file 
    Log(config_file= '/yyy.ini', log_file = '/yyy/').log_reset()
    logging.getLogger().info("info with new logger")

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

xlogs-1.0.1.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

xlogs-1.0.1-py2.py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 2 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