mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 12:35:13 +00:00
feat(logging): expand debug-logging coverage, add primitives, redaction & tests
Instrument the full download pipeline in the structured JSONL debug logger and make adding logging to new features a one-liner. Coverage: - DRM license request/response, content keys (incl. remote-CDM seam) and decrypt timing across Widevine/PlayReady/ClearKey - DASH/HLS/ISM manifest fetch + parse milestones (HLS.to_tracks also covers the m3u8_parser path used by iTunes/ATV-style services) - Per-backend vault get/add via the Vaults manager, track selection, subtitle conversion, repackage, normalize_vui, and full mkvmerge mux (command, duration, output size, warnings) - All external tooling (ffmpeg, ffprobe, mkvmerge, mkvpropedit, dovi_tool, SubtitleEdit, ccextractor) via a unified `tool_run` op, centralised in run_step/ffprobe + log_tool_run DX: - Add log_event() / timed_operation() primitives (no-op when disabled); retrofit ~91 guard/timing blocks onto them - Fix message= collision in log_drm_operation/log_vault_query/log_service_call that raised TypeError on the live decrypt path Redaction (redact_all = redact_text -> redact_url -> redact_path): - Collapse content/CDN/api URLs to `redacted[.ext]` - Strip local path prefixes (install root -> <unshackle>, venv -> <venv>, home -> ~) - Apply to every logged string so shared logs leak no URLs, paths or usernames - Drop per-request service_call logging (manifest parse is the request seam)
This commit is contained in:
@@ -24,7 +24,7 @@ from unshackle.core.downloaders import requests
|
||||
from unshackle.core.drm import DRM_T, PlayReady, Widevine
|
||||
from unshackle.core.events import events
|
||||
from unshackle.core.session import RnetSession
|
||||
from unshackle.core.utilities import get_boxes, try_ensure_utf8
|
||||
from unshackle.core.utilities import get_boxes, log_event, try_ensure_utf8
|
||||
from unshackle.core.utils.subprocess import ffprobe
|
||||
|
||||
|
||||
@@ -766,6 +766,13 @@ class Track:
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
log_event(
|
||||
"repackage",
|
||||
level="DEBUG",
|
||||
message=f"Repackaging {self.__class__.__name__} {original_path.name} with ffmpeg",
|
||||
context={"track_type": self.__class__.__name__, "id": self.id, "file": original_path.name},
|
||||
)
|
||||
|
||||
try:
|
||||
_ffmpeg()
|
||||
except subprocess.CalledProcessError as e:
|
||||
@@ -778,5 +785,17 @@ class Track:
|
||||
original_path.unlink()
|
||||
self.path = output_path
|
||||
|
||||
log_event(
|
||||
"repackage_complete",
|
||||
level="DEBUG",
|
||||
message=f"Repackaged {self.__class__.__name__} -> {output_path.name}",
|
||||
context={
|
||||
"track_type": self.__class__.__name__,
|
||||
"id": self.id,
|
||||
"output": output_path.name,
|
||||
"output_size": output_path.stat().st_size if output_path.exists() else 0,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
__all__ = ("Track",)
|
||||
|
||||
Reference in New Issue
Block a user