Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created May 12, 2021 15:33
Show Gist options
  • Save Abhayparashar31/14dc404313c724598c37a9c4c21212bf to your computer and use it in GitHub Desktop.
Save Abhayparashar31/14dc404313c724598c37a9c4c21212bf to your computer and use it in GitHub Desktop.
import logging
logging.basicConfig(level=logging.DEBUG,filename='data.log', filemode='a', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%d/%m/%Y %H:%M:%S')
name = str(input("Enter Your Name:\n"))
logging.info(f"{name} has logged in successfully !!")
-----------------data.log file output-------------
12/05/2021 21:01:37 - root - INFO - Abhay Parashar has logged in successfully !!
12/05/2021 21:02:47 - root - INFO - Karl has logged in successfully !!
12/05/2021 21:03:27 - root - INFO - Rahul has logged in successfully !!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment