https://github.com/miracleyoo/logging-bestpractice-deeplearning
logging Module's Best Practices in Deep Learning Projects
https://github.com/miracleyoo/logging-bestpractice-deeplearning
deep-learning logging python
Last synced: over 1 year ago
JSON representation
logging Module's Best Practices in Deep Learning Projects
- Host: GitHub
- URL: https://github.com/miracleyoo/logging-bestpractice-deeplearning
- Owner: miracleyoo
- Created: 2023-08-07T00:46:57.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-07T00:50:17.000Z (almost 3 years ago)
- Last Synced: 2025-01-21T15:50:03.493Z (over 1 year ago)
- Topics: deep-learning, logging, python
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `logging` Module's Best Practices in Deep Learning Projects
## Introduction
This document describes the best practices for using the `logging` module in Deep Learning projects. As we know, the `logging` module is a powerful tool for debugging and monitoring the execution of a program. However, it is not easy to use it properly, especially in a large and complex deep learning projects with multiple files and hierarchies. In such projects, it is very important to have a consistent and well-organized logging system, which can help us to debug and monitor the program efficiently. Also, we usually don't need to consider the overflow of the log files, because the log files are usually small in size for such projects, which gives us less pressure to manage the log files. Certainly, although I call it "best practices", it is not the only way to use the `logging` module, but it is a good way to use it in deep learning projects for beginners to `logging` module.
- This project gives an example of how to use the `logging` module in a deep learning project, you can use it as a template for your own project.
- It supports:
- Logging to both console and file.
- Parse command line arguments to set the logging level.
- Give each module its own logger with the module's name.
- A proper format for the log messages for deep learning projects, which includes the datetime, module name, message level, line number, and the message itself.
- With minimal effort, you can use it in your own project by replacing your `print` statements with statements like `logger.info` or `logger.debug`.
- It is based on the [Python Logging Cookbook](https://docs.python.org/3/howto/logging-cookbook.html), [Python Logging HOWTO](https://docs.python.org/3/howto/logging.html), and the [Python Logging Best Practices: The Ultimate Guide](https://coralogix.com/blog/python-logging-best-practices-tips/).
Have fun!