Skip to content

Instantly share code, notes, and snippets.

@myazdani
Created June 30, 2020 16:15
Show Gist options
  • Save myazdani/79ab68e262f082aca250f7f7600ec12e to your computer and use it in GitHub Desktop.
Save myazdani/79ab68e262f082aca250f7f7600ec12e to your computer and use it in GitHub Desktop.
import argparse
from loguru import logger
parser = argparse.ArgumentParser(description='Minimal example of dumping args into log file.')
parser.add_argument('--flag',type=str,
help='Some parameter flag')
args = parser.parse_args()
logger.add("file_{time}.log")
for arg, value in sorted(vars(args).items()):
logger.info("Argument {}: {}", arg, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment