Reduce noisy debug logs

- hotreload: only log signal file when mtime actually changes
- auth_api: only log timecost for requests taking > 1 second
This commit is contained in:
yumoqing 2026-06-01 23:26:27 +08:00
parent 25db7851b1
commit 39c8cfed2d
2 changed files with 3 additions and 3 deletions

View File

@ -174,7 +174,8 @@ class AuthAPI:
try: try:
ret = await handler(request) ret = await handler(request)
t3 = time.time() t3 = time.time()
debug(f'timecost=client({ip}) {user} access {path} cost {t3-t1}, ({t2-t1})') if t3 - t1 > 1.0:
debug(f'timecost=client({ip}) {user} access {path} cost {t3-t1:.3f}, ({t2-t1:.3f})')
return ret return ret
except Exception as e: except Exception as e:
t3 = time.time() t3 = time.time()

View File

@ -110,10 +110,9 @@ class HotReloader:
"""Check if cache invalidation signal file was updated.""" """Check if cache invalidation signal file was updated."""
try: try:
mtime = os.path.getmtime(SIGNAL_FILE) mtime = os.path.getmtime(SIGNAL_FILE)
debug(f'[hot_reload] signal file mtime: {mtime}, last: {self._last_signal_mtime}')
if mtime > self._last_signal_mtime: if mtime > self._last_signal_mtime:
self._last_signal_mtime = mtime self._last_signal_mtime = mtime
debug('[hot_reload] signal file changed, triggering reload') debug(f'[hot_reload] signal file changed, mtime: {mtime}')
return True return True
except OSError: except OSError:
pass pass