[go: up one dir, main page]

Skip to content

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

License

Notifications You must be signed in to change notification settings

SebiSebi/friendlylog

Repository files navigation

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.

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published