Last active
October 25, 2022 18:02
-
-
Save PFython/01e81703275d94b9cf7771aee9f81e63 to your computer and use it in GitHub Desktop.
Create a logger for every Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Create one log file per module using __file__ for the main filename. | |
""" | |
from log2d import Log, Path | |
if __name__ == '__main__': | |
log = Log(Path(__file__).stem, to_file=True).logger | |
# TEST | |
file_name = Path(__file__).name | |
log.critical(f'critical message from: {file_name}') | |
log.error(f'error message from: {file_name}') | |
log.warning(f'new warning message from: {file_name}') | |
log.info(f'info message from: {file_name}') | |
log.debug(f'debug message from: {file_name}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment