A logger package
Project description
letslog
This is a log module for people to log for their programs
Required Packages
datetime, logging, pathlib
Available Levels
INFO, DEBUG, WARNING, ERROR, CRITICAL
Constructor
letslog.Letslog constructor takes in 2 arguments with default option, one is logPath which states which folder that we want our log files to be put in, the other is absolute to indicate whether the first argument is an absolute path.
The default value for logPath is ..\log relative to the current working directory.
The default value for absolute is True.
For example:
If the current working directory is ~\Documents\my_program\src, and we want to initiate a log file at an already created folder ~\Documents\my_program\log
The following code sample can achieve such goal:
ll1 = letslog.Letslog() # Uses default arguments
ll2 = letslog.Letslog('..\log', absolute=False) # Uses relative path
ll3 = letslog.Letslog('~\Documents\my_program\log') # Uses absolute path
File Name
when we call ll.initiateLogger('logger_id', 'INFO'), we create a log with name <current datetime>+<logger_id>.log
Usage
import letslog
ll = letslog.Letslog() # Sets the log file location to default location
ll.initiateLogger('logger_id', 'INFO') # The created log file will be at '~\Documents\my_program\log\2020-06-24_203352logger_id.log'
ll.setLevel('WARNING') # We could change the level of this logger
ll.log('This is a warning!') # We could write a message to the logger using current logger level
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
File details
Details for the file letslog-0.0.5.tar.gz.
File metadata
- Download URL: letslog-0.0.5.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0bde369045ac810fc929721541771a58aca068338461779d1f9d416459ced58
|
|
| MD5 |
a092f28ab02799b3f386b0a4b5d70513
|
|
| BLAKE2b-256 |
cbf7fc06801c9596e73099dd3b9f45c5eb8ea52be1223355babba90d903bf4fc
|