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

Let's write beautiful logs

Project description

Coveralls Travis CI Latest Version https://img.shields.io/pypi/wheel/prettylog.svg https://img.shields.io/pypi/pyversions/prettylog.svg https://img.shields.io/pypi/l/prettylog.svg

Let’s write beautiful logs:

import logging
from prettylog import basic_config


# Configure logging
basic_config(level=logging.INFO, buffered=False, log_format='color')

Available formats

  • stream - default behaviour
  • color - colored logs
  • json - json representation
  • syslog - writes to syslog

Quick start

Setting up json logs:

import logging
from prettylog import basic_config


# Configure logging
basic_config(level=logging.INFO, buffered=False, log_format='json')

Buffered log handler

Parameter buffered=True enables memory buffer which flushing logs delayed.

import logging
from prettylog import basic_config

basic_config(
    level=logging.INFO,
    buffered=True,
    buffer_size=10,             # flush each 10 log records
    flush_level=loggging.ERROR, # or when record with this level will be sent
    log_format='color',
    date_format=None,           # Disable date for logs, True enables it.
                                # str with format is custom date format.
)

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 prettylog, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size prettylog-0.3.0-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size prettylog-0.3.0.tar.gz (4.2 kB) File type Source Python version None 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