Skip to content

Replace console.debug/console.error with injectable logger #108

@rbren

Description

@rbren

Problem

~15 instances of console.debug and console.error in production library code:

  • RemoteWorkspace: console.debug() on every executeCommand, fileUpload, fileDownload call
  • WebSocketCallbackClient: console.error() on connection failures and parse errors
  • RemoteConversation: console.error() on event add failures
  • RemoteState: console.error() on state update failures
  • SecretRegistry: console.error() on secret retrieval failures

Library code should not log to console — it pollutes consumer output and can't be controlled or filtered by the application.

Proposed Fix

Accept an optional logger in constructor options:

interface Logger {
  debug(message: string, ...args: unknown[]): void;
  warn(message: string, ...args: unknown[]): void;
  error(message: string, ...args: unknown[]): void;
}

// Usage
new RemoteWorkspace({
  host: '...',
  workingDir: '...',
  logger: console,  // opt-in to console logging
});

Default to a no-op logger. This lets consumers route logs to their own logging infrastructure.

Impact

Medium — improves library hygiene and gives consumers control over logging.


This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions