logzilla is a simple yet capable python logging wrapper that gives you better defaults like coloured output.
It requires Python 3.8.1+ to run.
pip install logzilla
In both examples a .log
folder is created in the output directory with the
following files corresponding to the date and time of execution of each example:
2023.04.10 15.54.23_logzilla.log
2023.04.10 16.18.29_logzilla.log
Sample log file output:
2023/04/10 15:55:16: logzilla.py:115: INFO: LogZilla: Root logger initialized.
2023/04/10 15:55:16: logzilla.py:121: INFO: ********************************************************************************
2023/04/10 15:55:16: logzilla.py:122: INFO: ******************************** LogZilla Demo *********************************
2023/04/10 15:55:16: logzilla.py:123: INFO: ********************************************************************************
2023/04/10 15:55:16: logzilla.py:183: DEBUG: debug message
2023/04/10 15:55:16: logzilla.py:184: INFO: info message
2023/04/10 15:55:16: logzilla.py:185: WARNING: warning message
2023/04/10 15:55:16: logzilla.py:186: ERROR: error message
2023/04/10 15:55:16: logzilla.py:187: CRITICAL: critical message
2023/04/10 15:55:16: logzilla.py:137: INFO: Execution Time of <main>: 0:00:00.012001 hh:mm::ss
@log_execution_time
def main() -> None:
current_file_path = Path(__file__).absolute()
current_file_dir = current_file_path.parent
LogZilla.init_root_logger(
output_dir=current_file_dir,
console_level=logging.DEBUG,
file_level=logging.DEBUG,
)
log_title("LogZilla Demo")
logger = logging.getLogger(__name__)
logger.debug("debug message")
logger.info("info message")
logger.warning("warning message")
logger.error("error message")
logger.critical("critical message")
Output:
@log_execution_time
def main() -> None:
current_file_path = Path(__file__).absolute()
current_file_dir = current_file_path.parent
LogZilla.init_root_logger(
output_dir=current_file_dir,
console_level=logging.DEBUG,
file_level=logging.DEBUG,
no_console_file_info=True,
)
log_title("LogZilla Demo")
logger = logging.getLogger(__name__)
logger.debug("debug message")
logger.info("info message")
logger.warning("warning message")
logger.error("error message")
logger.critical("critical message")
- add unit tests
- add pre-commit hooks for
black, pylint, flake8, bandit, tox, pytest
for development environment