I'm using python2.x logging module, like,
logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
filename='logs.log',
level=logging.INFO)
I want my program to overwrite logs.log file for each execution of the script, currently it just appends to old logs. I know the below code will overwrite, but if there is a way to do it via logging config, it'll look better.
with open("logs.log", 'w') as file:
pass