Skip to main content

A logging toolkit

Project description


logging toolkit


pip install xlogs


1. Use as decorator

from xlogs import log

if __name__ == '__main__':
    # config_file: the logging config template, use the default if None
    def division():

2. Load from ini config file

from xlogs import LogConfig
import logging

if __name__ == '__main__':
    LogConfig(config_file= '/xxx.ini', log_file = '/xxx/')'Default load to root')
    info = logging.getLogger('root')'write msg to test.log')

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

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

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

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

3. config with args

from xlogs import get_logger

if __name__ == '__main__':
    logger = get_logger(debug=True, logfile='/message.log')"info oooooo")
    logger.debug("debug ggggg")
    logger.error("err rrrr")

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.3.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

xlogs-1.0.3-py2.py3-none-any.whl (13.4 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