Add owner-only logging and Brickset API call tracking
LIM configured no logging at all, so the instruction fetcher had no trail to follow. Adds a rotating file handler on the root logger plus two owner-only admin pages. - Admin > Logs: filter by level, source and text; tracebacks kept with their error; auto-refresh, raw download, rotated-file browsing and rotate-now - Admin > Logs > Brickset API calls: every outbound call recorded with method, params, caller, duration, result count and error, plus daily quota accounting (only getSets counts) and a comparison against getKeyUsageStats - New owner concept (services/ownership.py): a single account, distinct from is_admin, since these pages expose other admins activity. Defaults to the first admin; flask owner show/set to change - Services now log through module loggers; retention setting and pruning for call records - New CLI: flask owner show/set, flask logs path/prune - New table brickset_api_calls, created automatically at boot; LOG_* env vars, /data/logs in Docker
This commit is contained in:
1 parent
89f65e2d74
commit
f7c20de5ac
27 files changed
+1914
-35
No files matched your search
@@ -18,6 +18,7 @@ A Python web application for organizing and managing your LEGO instruction manua
|
||||
- 🖼️ **Image Gallery**: View instruction images in an organized gallery
|
||||
- 📄 **PDF Support**: View and download PDF instructions directly
|
||||
- 💾 **Backup & Restore**: One-click archive of the database plus every uploaded file, ready to restore anywhere
|
||||
- 📋 **Logging & API tracking**: Owner-only log viewer and a record of every Brickset call with daily quota accounting — see [docs/LOGGING.md](docs/LOGGING.md)
|
||||
- ⬇️ **Automatic Instruction Fetcher**: Downloads official instruction PDFs from LEGO (found via Brickset) for official sets, one every 10 minutes so nobody's API gets hammered — see [docs/INSTRUCTION_FETCHER.md](docs/INSTRUCTION_FETCHER.md)
|
||||
|
||||
## 🚀 Quick Start
|
||||
@@ -188,6 +189,10 @@ flask --app run.py shell
|
||||
- page_number, user_id, uploaded_at
|
||||
- sha256, source (set by the automatic fetcher; null for manual uploads)
|
||||
|
||||
### BricksetApiCall
|
||||
- id, called_at, method, params, context, ok, http_status
|
||||
- result_count, duration_ms, quota_counted, message, user_id
|
||||
|
||||
### InstructionFetchJob
|
||||
- id, set_id, status, attempts, files_added, source, message
|
||||
- queued_at, not_before, started_at, finished_at, queued_by_id
|
||||
|
||||
Reference in new issue
Block a user