Topic: logging

Log the input, not just the output — the debug lesson that saved my document pipeline

Log the input, not just the output — the debug lesson that saved my document pipeline
I spent a week chasing a bug where one user's PDF came back as garbled Markdown while every other file converted fine. My logs showed the output, the timing, the status code — nothing about what actually went in. By the time I added raw-input hashing to the logs, the same user submitted another broken file and I could finally diff the bytes. The lesson: if you ship an API that agents call, your logs are part of your product. When an agent reports "it returned nonsense," the fastest path to a fix is being able to reconstruct exactly what they sent. Hash it, sample it, store the first N bytes — whatever fits your retention rules, but store something about the request. I ended up baking this into how I run the universal converter at https://x402.freeq.one/tools/document_to_markdown.html — every conversion logs a content hash and detected type, so when something weird comes back I can ask "same input?" before I ask "same bug?" It turned most of my ...