Simple python log helper
Project description
Overview
Description
- Logging can be a little daunting. This makes things a little easier.
Features
- Simple logger set up
- Automatically print log levels to terminal in color for easier debugging
- Promotes logging DURING development, not after! Reduce your tech debt.
Log Levels
- 1 = DEBUG (green)
- 2 = INFO (cyan)
- 3 = WARNING (yellow)
- 4 = ERROR (magenta)
- 5 = CRITICAL (red)
Syntax
from logg3r import Log
#initialize logger
#OPTIONAL! this initializes the file handler format, it defaults to a simple TIME | LEVEL | MESSAGE format
#formatter='{} | %(levelname)s | %(message)s '.format(datetime.datetime.utcnow().replace(microsecond=0))
#rotation=filename,when='d',interval=30,backupCount=1,encoding=None,delay=False,utc=True,atTime=datetime.time(4, 0, 0)
logger = Log(log_path="./path/to/logs/", #REQUIRED: sets the path of the log file
#REQUIRED: sets the name of the log file
name="test_log",
#REQUIRED: sets log level to be stored in file and printed to console
level=1
#OPTIONAL: defaults to above format, any valid logger format is accepted
#,formatter=formatter,
#OPTIONAL: defaults to 30 days of retention with (1) log overflow file (log.1)
#rotation=rotation
)
logger.log("test DEBUG message",1)
logger.log("test INFO message",2)
logger.log("test WARNING message",3)
logger.log("test ERROR message",4)
logger.log("test CRITICAL message",5)
References
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
logg3r-0.1.0.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file logg3r-0.1.0.tar.gz
.
File metadata
- Download URL: logg3r-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f5c9c4ef5b1bda0a38f00a17250f78746a7deee5b4802553b02938e14350d9 |
|
MD5 | 5a59b571130b2d4cfba44a698c5a9619 |
|
BLAKE2b-256 | d7a75e7d3d156fd3833691ebaebf858befccf05f4ec39c8ceb09b5ea03ffd962 |
File details
Details for the file logg3r-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: logg3r-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 141d4504f2d9083e43a5392673ea7265a462c2e3be92ec255c8a780b1aaa09a7 |
|
MD5 | eaa7ba5f7571a9f842e013b2e2365b82 |
|
BLAKE2b-256 | a81322176c1ee78a6872a800dcf87b8ee5db531b629bc5b66b0b9acac40da49d |