/
githubmirror
/
AgentPilot
Обзор
Документация
Войти
/
githubmirror
/
AgentPilot
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.3.0
src/utils/logs.py
38 строк
959 B
jbexta
sql upgrade
11 мар 2024, 18:20
11 мар 2024, 18:20
3d190d8
Код
Авторство
О чём код?
from src.utils import sql # from agentpilot.utils.popups import show_popup class Logger: def __init__(self): self.log = [] def add(self, _type, message): # Types: # task created # task resumed # task cancelled # task error # task completed # request # action # observation self.log.append((_type, message)) def print(self): for _type, message in self.log: print(f'{_type}: {message}') def insert_log(type, message, print_=True): try: # if print_ and config.get_value('system.debug'): # print("\r", end="") # cprint(f'{type}: {message}', 'light_grey') # print(f'{type}: {message}') sql.execute(f"INSERT INTO logs (log_type, message) VALUES (?, ?);", (type, message)) except Exception as e: print('ERROR INSERTING LOG') def log_invalid_task_decision(popup): pass