Easily create useful logger.
Project description
Exzlogger
Extremely Easy Logger
This package is made to easily create logger that is suit for most of the situations, including following functions:
- automatically create "log" folder under the work directory
- the log information will be displayed on stdout, and will also be stored in the .log file
- allow user to set the information level for both stdout and log file
- nicely formatted log information, including the timestamp and information type
Parameters
stdout_level
<str>: The log level to be used for stdout ('INFO', 'ERROR', 'DEBUG', or 'WARNING'), Defaults to 'INFO'.file_level
<str>: The log level to be used for the log file ('INFO', 'ERROR', 'DEBUG', or 'WARNING'), Defaults to 'DEBUG'.log_file
<str>: The path and name of the log file to write the log messages, defaults to 'logfile.log'.
Returns
logger
<logging.Logger>: The initialized logger instance.
Dependencies
- pathlib
- logging
- sys
Useage
# Imports
from exzlogger import initialize_logger
logger = initialize_logger(stdout_level='INFO', file_level='DEBUG', log_file='logfile.log')
# Error & Debug (suggest to import traceback for debug)
logger.error(f"[func_name]: error message<{e}>")
logger.debug(f"[func_name]: error message<{e}>\n**********\n{traceback.format_exc()}**********")
# Info
logger.info(f"[func_name]: message")
# Warning
logger.warning(f"[func_name]: warning message")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
exzlogger-0.0.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for exzlogger-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da26907e897f4c69b4eb400bf967f9b7d1a897329ff6d17a4f8d814429f3a637 |
|
MD5 | 833614043930c8b3377618dbc295fd72 |
|
BLAKE2b-256 | fcae8b52c5ded0b3a8c47d6d101a5e040b3528988ba872aac52b36b7a0ecb06e |