how to keep error log file in windows c# code example
Example 1: how to delete everything on a file python
f = open('file.txt', 'r+')
f.truncate(0) # need '0' when using r+
Example 2: python log to file and console
import logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[
logging.FileHandler("debug.log"),
logging.StreamHandler()
]
)