DSH | dsh-logbook | See your plugins' log output at last (dsh silently drops warnings today) #5138
d3vmeh
started this conversation in
Show Your Plugins!
Replies: 1 comment
|
I wrote up the two cordis findings behind this plugin here: #5145 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Project URL:
https://github.com/d3vmeh/dsh-logbook
npm:
https://www.npmjs.com/package/dsh-logbook
Introduction
While building my last plugin I found something surprising about DSH logging, and this plugin came out of it.
Every plugin logs through
ctx.logger, but no shipped profile mounts a log sink (#2905, #1241, #4994). The only default destination is a 1000-record in-memory buffer. The surprise: that buffer silently dropswarnanddebugrecords. Cordis orders its levels error=0, info=1, warn=2, debug=3, and the buffer exporter falls back to a logger default of 1, so a plugin can warn about a real problem and the warning goes nowhere at all, not even into memory. You can verify it in one minute:dsh-logbook registers one full-capture exporter (asks cordis for everything, filters itself) and gives you two views:
llm-gate: debug,hmr: off). Never stdout, which stays free for SDK/ACP protocol traffic./logsin the chat: the recent history, all levels, with--level,--name,--grep,--since,--limitfilters.How it integrates with DSH
A host-side cordis plugin, one file. It registers a single
ctx.logger.exporterwithlevels: { default: 3 }and a/logscommand viactx.commands. It filters by type name in its own code because a numeric threshold cannot express "warnings and errors only" in cordis's ordering (info sits below warn). The stderr writer attaches an error listener so a closed pipe (a dyingtee) cannot crash the host, something a plainprocess.stderr.writein a try/catch does not protect against.Works with zero config; works headless.
What you should know
exporter()disposer removes the most recently registered exporter instead of its own, so a plugin reload can detach another plugin's log sink. dsh-logbook keeps an internal flag so a stale copy of its exporter goes inert. I will write both cordis findings up separately.This joins my local-model set (dsh-llm-gate #4995, dsh-context-budget #5078, dsh-fetch-timeouts #5124, dsh-turn-doctor #5135), though this one is for every plugin user, local model or not.
MIT License. Feedback welcome!
> Unofficial project, independently developed and maintained by community members.
All reactions