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.

Source Distribution

friendlylog-1.0.2.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

friendlylog-1.0.2-py3-none-any.whl (9.4 kB view hashes)

Uploaded 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