mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 07:25:08 +00:00
docs: sweep docs to zero ste_lint findings and one remote session name
This commit is contained in:
@@ -79,7 +79,7 @@ Every line is a self-contained JSON object. The first line of each log file reco
|
||||
|
||||
Quote `unshackle_code_hash` in a bug report. It fingerprints the framework source you operate, so it tells us the exact code state even when you did not install from git. A hash that matches no release means that someone edited the source locally.
|
||||
|
||||
Subsequent lines record the operations: service calls, DRM licence requests, vault lookups, downloader progress, and errors. Common fields include:
|
||||
Subsequent lines record the operations: service calls, DRM challenges and licences, vault lookups, downloader progress, and errors. Common fields include:
|
||||
|
||||
| Field | Meaning |
|
||||
|---|---|
|
||||
@@ -358,32 +358,3 @@ Each command reports how many files it removed and how much space it freed, then
|
||||
unshackle loads the **first** `unshackle.yaml` it finds, in the order that [Where the config file lives](../getting-started/configuration-file.md#where-the-config-file-lives) gives.
|
||||
|
||||
If you have config in more than one of those locations, an earlier one wins and unshackle silently ignores your edits to a later file. `unshackle env info` prints the path it loaded (or, if none exists, shows every candidate location so you can make the file correctly). See [Configuration](cli-reference.md#cfg) for editing values with the `cfg` command.
|
||||
|
||||
---
|
||||
|
||||
!!! note "Developer note: structured logging in code"
|
||||
Service and command code sends entries through the shared `log_event(...)` helper (and the `timed_operation(...)` context manager for timing a block) from `unshackle.core.utilities`. These are no-ops when you disable debug logging, so they are always safe to leave in place. When you add a new feature, call `log_event("my_feature_event", message="...", context={...})`. Do not write the "is the logger enabled?" guard again. unshackle does the redaction and the JSON-serialisation for you, and redacts any field whose name looks like a content key, a secret, or a token. Content keys only appear when the run has `debug_keys` enabled.
|
||||
|
||||
### Logging conventions when adding entries
|
||||
|
||||
The debug log is tuned for **developers troubleshooting pipeline flow** (maximum signal, minimum noise), not for end users. A few conventions keep it that way. The `log_event` signature does not enforce them, so they are easy to miss and worth stating explicitly.
|
||||
|
||||
!!! tip "Log levels are a flow skeleton, not just severity"
|
||||
Treat `level` as structure, not decoration. Send exactly **one `INFO` milestone per pipeline stage** so that `jq 'select(.level=="INFO")'` reads back the whole end-to-end flow of a run. Everything internal goes to `DEBUG`. Failures go to `ERROR`. A sparse `INFO` is the whole point. It is the line a developer skims first to see where a run got to before it broke.
|
||||
|
||||
```console
|
||||
# Read the pipeline's high-level flow, one line per stage
|
||||
jq 'select(.level == "INFO")' unshackle_debug_EXAMPLE_20260703-142530.jsonl
|
||||
```
|
||||
|
||||
!!! warning "No request bodies and no raw dumps"
|
||||
A `log_event` entry never holds a request body or a raw dump: no full `Tracks` object, no MPD/manifest body and no response payload. Only `debug_requests` records request and response bodies, and only as files in its separate body folder. Log only **counts, ids, sizes, and `safe_display_url(url)`**. This keeps the log low-noise and prevents leaking title or manifest data into the file *before* redaction even runs. Redaction is a backstop, not a licence to dump raw objects.
|
||||
|
||||
!!! note "Operation names: `<area>_<event>`, no registry"
|
||||
Operation names are plain lowercase strings that follow an `<area>_<event>` convention: `manifest_dash_parse`, `drm_decrypt`, `vault_get_key`, `tool_run`. We write them inline at each call site on purpose. There is **no central registry or enum**. Do not look for one, and do not make one. The absence is a deliberate design choice, not an omission.
|
||||
|
||||
!!! note "Message reads alone; data lives in fields"
|
||||
Give every entry a single-sentence `message` that stands on its own. Put all structured data (`context`, counts, ids, `duration_ms`) in **fields**, not in the prose. This separation lets the log be both human-scannable and machine-filterable. A message like `"Parsed DASH manifest"` with `context={"video": 4, "audio": 2}` beats `"Parsed manifest with 4 video and 2 audio tracks"`.
|
||||
|
||||
!!! tip "Let tool runs log themselves"
|
||||
For external-tool calls (FFmpeg, mkvmerge, `dovi_tool`, and friends), route through `run_step` / `run_tool` / `ffprobe`, which auto-emit a `tool_run` entry capturing the binary's version, return code, and duration consistently. `run_tool` also raises `ToolFailed`, whose message names the tool, the exit code and the last lines the tool wrote. A failure that the caller recovers from (a retry, a fallback) is named with `handled=` (exit codes or stderr text): its `tool_run` entry is `DEBUG`, not `ERROR`, and the call still raises. Only fall back to calling `log_tool_run` manually for a direct `subprocess.run` you genuinely cannot route through those helpers. Auto-logging is the preferred path precisely because it captures those fields the same way every time.
|
||||
|
||||
Reference in New Issue
Block a user