A simple(r) logger for Python
Project description
logEZ
Make logging easy in your applications! Use this simple library to easily use logs in any of your applications.
How to run
from logEZ import MyLogger
logger = MyLogger()
MyLogger()
The init
method of class MyLogger takes four default arguments.
log_file_name
, logging_level
, disable_console_logs
and disable_file_logs
The default values are
log_file_name="logEZ.log",
logging_level="INFO",
disable_console_logs=False,
disable_file_logs=False
-
log_file_name
You can specify the file name of your log file here.
-
logging_level
You can specify the default logging level of your logs.
It can be
INFO
,DEBUG
,WARNING
,ERROR
orCRITICAL
-
disable_console_logs
This disables the console logging of your logs, if set
True
. -
disable_file_logs
This disables the file logging of your logs, if set
True
.
Methods
Once you have an object initialized, you can use the following methods.
setLoggingLevel(level)
: To change the logging level after initializingMyLogger()
. (Referlogging_level
underMyLogger()
for levels)myDebug(str)
: To print adebug
log. Accepts string input.myInfo(str)
: To print aninfo
log. Accepts string input.myWarn(str)
: To print awarning
log. Accepts string input.myError(str, exc_info[Optional])
: To print anerror
log. Accepts string input. Ifexc_info
is setTrue
, it appends complete execution information along with the log string.myCrit(strm exc_info[Optional])
: To print anerror
log. Accepts string input. Ifexc_info
is setTrue
, it appends complete execution information along with the log string.myExcept(str)
: To print anexception
log. Accepts string input.
Change Log
0.0.1 (05/08/2022)
- First Release
- Removed requirements.txt
- Removed logging from install_requires
0.0.2 (05/08/2022)
Fixing project directory name
0.0.3 (05/08/2022)
Updated code with method name fix and logging level method. Added How to use with complete method definition in readme.
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 logEZ-0.0.3.tar.gz
.
File metadata
- Download URL: logEZ-0.0.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43445a31612322f835ae078965c70a2678fa2c008d24ad3be68111a135b74fa2 |
|
MD5 | a44eb6e36e2a67e4d5a6c13a4542e824 |
|
BLAKE2b-256 | d018ff1e2520f50024603ef01076630dea899143196da03bd76a65f4cc996cf8 |