You've already forked calibre-plugins
mirror of
https://github.com/crosspoint-reader/calibre-plugins.git
synced 2026-02-13 15:13:51 -08:00
Source from @itsthisjustin in https://github.com/crosspoint-reader/crosspoint-reader/pull/404
18 lines
290 B
Python
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)
|