Add logging utility (logging/setLevel, notifications/message) #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add the Logging utility — client-settable log level and a server→client log-message notification stream.
Goal
Today lmcp writes diagnostics to
io.stderr, which is invisible to the client. Tools likeshell/fetch/web_searchthat decide to log "DDG returned 202 anti-bot" or "renderer cache miss" have nowhere to surface that. The spec's logging utility provides a structured channel.Methods to add
logging/setLevel{ level: "debug"|"info"|"notice"|"warning"|"error"|"critical"|"alert"|"emergency" }→{}notifications/message{ level, logger?: string, data: any }.API for lmcp
Capabilities
Scope (v1)
"warning"until the client sets one.Depends on
Priority
Medium-low. Real value gated on bidirectional transport. Half a day with stderr fallback; rest unlocks naturally with the transport rewrite.
Implemented (with stderr fallback). Added in lmcp.lua:
server:log(level, logger, data)emits to stderr (immediate) AND enqueuesnotifications/messagefor future Streamable-HTTP delivery (issue #16)logging/setLeveldispatch with -32602 on missing/unknown level; returns{}(json.empty_object sentinel) on successlogging:{}advertised iffopts.logging = trueat construction (opt-in, mirrors resources/prompts/completions discipline)warninguntil the client picks oneVerified live over stdio: setLevel(info) accepts; setLevel(bogus) → -32602; emit cycle drops below threshold; queue accumulates emitted entries; bad level / missing level both → -32602.
Delivery of
notifications/messageto the client remains gated on issue #16. Stderr fallback is the user-visible behaviour today.