Skip to content

types.ts: LoopCliConfig.logger docstring says 'VerboseLogger instance' but LoggerSpec accepts any Logger #78

@joewalker

Description

@joewalker

Observed behavior

The docstring on LoopCliConfig.logger in src/types.ts reads:

/**
 * Controls verbose diagnostic logging to stderr. Accepts a concrete
 * `VerboseLogger` instance, the string `'verbose'` (which creates an
 * enabled logger), or `undefined` (quiet, the default).
 */
readonly logger?: LoggerSpec;

This says the field accepts a VerboseLogger instance. But LoggerSpec in src/loggers.ts is defined as:

export type LoggerSpec = Logger | 'verbose' | undefined;

Any object implementing the Logger interface is accepted, not just VerboseLogger. The README and createLogger implementation both treat the field as Logger | 'verbose' | undefined, so callers writing custom loggers will hit no runtime problem; they just see misleading documentation that suggests they have to use VerboseLogger.

Expected behavior

The docstring should describe the field as accepting any Logger implementation (with VerboseLogger mentioned as the built-in option), the string 'verbose', or undefined.

Minimal reproduction

Open src/types.ts and inspect the comment block on the logger field of LoopCliConfig (around line 103), then compare with the LoggerSpec definition in src/loggers.ts.

Suggested fix

Update the docstring to refer to Logger (the public interface) rather than VerboseLogger. For example:

Controls verbose diagnostic logging to stderr. Accepts a concrete
`Logger` instance, the string `'verbose'` (which creates an enabled
`VerboseLogger`), or `undefined` (quiet, the default).

Metadata

Metadata

Assignees

No one assigned

    Labels

    S4Clean-ups or nits with low behavioral riskbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions