Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

delogger is a convenient logging package

Project description

delogger

Build Status PyPI License: MIT

Abount

Delogger is a Python package that makes easy use of decided logging.

The default logging includes the following:

  • Stream handler
  • In save mode, log is saved in directory as program execution unit.

Delogger

  • It behaves like normal logging.
  • Decorator Delogger.debuglog logging arguments and return values

DeloggerQueue

  • Non-blocking logging using QueueHandler.
  • Decorator DeloggerQueue.debuglog logging arguments and return values

Settings

variable name description default
date_fmt date and time format '%Y-%m-%d %H:%M:%S'
stream_level Stream level logging.INFO
file_level Level of file output logging.DEBUG
is_save_file whether to save the log file False
is_color_stream whether to make the stream color output False
is_debug_stream Whether to output the stream in debug mode False
default Whether to use the default handler True
dirpath log output folder 'log'
filepath log output filepath None
is_stream If False, disabled stream output True
backup_count logfile backup_count 5

Installation

To install Delogger, use pip.

pip install delogger

Examples

Normal stream mode

from delogger import Delogger

delogger = Delogger(name='test_logger')
logger = delogger.logger

logger.info('Start logging')
logger.debug('debug')
logger.warning('warning')
logger.info('End logging')

normal

Debug stream mode

from delogger import Delogger

Delogger.is_debug_stream = True
delogger = Delogger(name='test_logger')
logger = delogger.logger

logger.info('Start logging')
logger.debug('debug')
logger.warning('warning')
logger.info('End logging')

debug

Save log file

from delogger import Delogger

Delogger.is_save_file = True
delogger = Delogger(name='test_logger', filepath='%Y/%m%d.log')
logger = delogger.logger

logger.info('Start logging')
logger.debug('debug')
logger.warning('warning')
logger.info('End logging')

logfile

Queue mode

import time

from delogger import DeloggerQueue

delogger = DeloggerQueue(name='test_logger')
logger = delogger.logger

print('Start queue mode')
logger.info('Start logging')
logger.debug('debug')
logger.warning('warning')
time.sleep(1)
logger.info('End logging')
print('End queue mode')

queue

No Color stream mode

from delogger import Delogger

Delogger.is_color_stream = False
delogger = Delogger(name='test_logger')
logger = delogger.logger

logger.info('Start logging')
logger.debug('debug')
logger.warning('warning')
logger.info('End logging')

no-color-normal

Debug and no color stream mode

from delogger import Delogger

Delogger.is_color_stream = False
Delogger.is_debug_stream = True
delogger = Delogger(name='test_logger')
logger = delogger.logger

logger.info('Start logging')
logger.debug('debug')
logger.warning('warning')
logger.info('End logging')

no-color-debug

Project details


Download files

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

Files for delogger, version 0.2.4
Filename, size File type Python version Upload date Hashes
Filename, size delogger-0.2.4-py3-none-any.whl (14.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page