center-randomize
center-randomize copied to clipboard
[FEAT] Added custom logger function
Added a module under the utils
directory to create a slightly customized logger function.
Replaced the 4 print statements at the end of the main file with the logger.
How to use:
- Import the
setup_logger
function in the desired module - Call the function with the name of the current module
- Use the logger with appropriate loging level
Screenshot:
I'd recommend using loguru for efficiency and avoiding any bugs on custom implementation.
I'd recommend using loguru for efficiency and avoiding any bugs on custom implementation.
I think Python builtin logging module is quite self sufficient for the current use case and it just needs the configuration. Also works across all platform, it's best to avoid additional package for the same. It might be a bit overkill
Working on it.
Changes made:
- Used
logging.config.dictConfig
to configure the logger with custom options. - Called the logger config function at the top of
school_center.py
file. - Error level logs are saved under project_root/logs/custom_logs.log (ignored).
Console logs:
Log file:
I have added the mentioned changes. Please review @horrormyth.