# Chapter11Mod.py from datetime import datetime # from MODULE import Object def log_error(error_id, error_type): try: now = datetime.now() timestamp = now.strftime("%Y-%m-%d") filename = f"log_{timestamp}.txt" with open(filename, mode='a') as file: varErrorString = f"Error ID: {error_id}, Error Type: {error_type}, Time of Error: {now}.\n" file.write(varErrorString) print(f"Error logged in filename: {filename}.") except IOError as err: print(f"Error occurred: {err}") except Exception as err: print(f"Error occurred: {err}") finally: print("OK")