mercredi 22 avril 2020

Can we create separate log for every execution using python

File1.py
import logging

LOG_FILENAME = "logfile.log"
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG) 
dev test_TC01():
logging.log("Testcase1 is executing in file1")

dev test_TC02():
logging.log("Testcase2 is executing in file1")

File2.py

dev test_TC01():
logging.log("Testcase1 is executing in file2")

dev test_TC02():
logging.log("Testcase2 is executing in file2")

File3.py

dev test_TC01():
logging.log("Testcase1 is executing in file3")

dev test_TC02():
logging.log("Testcase2 is executing in file3")

Can we create one reusable class for logging purpose? I want to create only one log for every execution for 3 files and i want to create separate log for every execution.

I don't have much knowledge on python. can someone help me on this.

Aucun commentaire:

Enregistrer un commentaire