Skip to main content

Python logging for humans: colorful, clean interface, straightforward usage, simply friendly log.

Project description

FriendlyLog: Python logging made simple

FriendlyLog logo

License Build Status codecov Codacy Badge

Python Versions Downloads

FriendlyLog is a simple, colorful, user-friendly, thread-safe logger for Python (2 and 3).

Install

pip install friendlylog

Usage

  1. Simple Logger
import logging

from friendlylog import simple_logger as log

# Anything above or including DEBUG will be logged.
log.setLevel(logging.DEBUG) 

log.debug("debug message")
log.info("info message")
log.warning("warning message")
log.error("error message")
log.critical("critical message")

Will result in the following logs (test.py is the name of the file):

[07-Oct-19 11:06:06.107 in test.py - <module>:   3] DEBUG: debug message
[07-Oct-19 11:06:06.107 in test.py - <module>:   4] INFO: info message
[07-Oct-19 11:06:06.107 in test.py - <module>:   5] WARNING: warning message
[07-Oct-19 11:06:06.107 in test.py - <module>:   6] ERROR: error message
[07-Oct-19 11:06:06.107 in test.py - <module>:   7] CRITICAL: critical message
  1. Colored Logger
import logging

from friendlylog import colored_logger as log

# Anything above or including DEBUG will be logged.
log.setLevel(logging.DEBUG) 

log.debug("debug message")
log.info("info message")
log.warning("warning message")
log.error("error message")
log.critical("critical message")

Will result in the following logs (test.py is the name of the file):

Contributing

  1. Write the code for a new logger under friendlylog. It should export the following methods:
    • setLevel(level)
    • debug(msg: string)
    • info(msg: string)
    • warning(msg: string)
    • error(msg: string)
    • critical(msg: string)
  2. Write unit tests with >92% coverage under tests. You can run the tests locally using this command: bash run_tests.sh. Make sure the new logger is thread-safe. Also, add a unit test that checks thread-safety;
  3. Submit a pull-request with your changes.

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 friendlylog, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size friendlylog-1.0.2-py3-none-any.whl (9.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size friendlylog-1.0.2.tar.gz (3.9 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 DigiCert DigiCert EV certificate StatusPage StatusPage Status page