from flask import current_app as app from datetime import datetime from pathlib import Path def read(filename:str): data = Path(app.config.get('DATA')) with open(f'./{data}/logs/{filename}') as file: return file.readlines() def write(filename:str, message:str): data = Path(app.config.get('DATA')) with open(f'./{data}/logs/{filename}', 'a+') as file: file.write(f'{datetime.now().strftime("%Y-%m-%d-%X")}: {message}\n')