Xteink-X4-crosspoint-reader/calibre-plugin/crosspoint_reader/plugin/log.py
2026-01-16 16:54:44 -05:00

18 lines
290 B
Python

import time
_LOG = []
_MAX_LINES = 200
def add_log(message):
timestamp = time.strftime('%H:%M:%S')
line = f'[{timestamp}] {message}'
_LOG.append(line)
if len(_LOG) > _MAX_LINES:
_LOG[:len(_LOG) - _MAX_LINES] = []
def get_log_text():
return '\n'.join(_LOG)