Last active
May 25, 2019 14:35
-
-
Save gargolito/f1d752dfe8a6c6fa53171d05bd3f109e to your computer and use it in GitHub Desktop.
loguru prevent stdout from core module
This file contains hidden or 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
| import os | |
| import sys | |
| scriptname = os.path.basename(sys.argv[0].split('.')[0]) | |
| # configure logging | |
| from loguru import logger as log | |
| log.remove() # supress luguru core stderr output | |
| log_path = '/var/log/' | |
| log.add(log_path + scriptname + "_{time:YYYYMMDD}.log", | |
| format="{time:MMM DD YYYY HH:mm:ss.SSS}-{level}-{function}-{message}", | |
| rotation="1 day", retention="7 days", compression="gz", delay=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment