Skip to content

refactor: delete the unused replaceLog and silence exports from lib/log.ts #380

Description

@diegolmello

Problem

lib/log.ts exports a mutable module-level logger plus two functions that mutate it globally:

export let logger: ILogger = new InternalLog()
export function replaceLog (externalLog: ILogger) { logger = externalLog }
export function silence () { replaceLog({ /* no-op handlers */ }) }

Neither replaceLog nor silence has a caller anywhere in the shipped source. The SDK injects a logger per instance instead — Api and Driver both take one through their options and keep it — which is why nothing needs the global swap.

They are also not reachable from the package entry point: index.ts re-exports only settings and Rocketchat.

Verified against the consuming app: it does not import the SDK's log module. (Its own logger.silence() call is WatermelonDB's logger, unrelated to this file.)

A process-global, mutable logger that any caller can replace is the kind of API that is hard to remove later once someone does start using it, and impossible to reason about in tests.

Steps to reproduce

  • Grep the SDK source for replaceLog and silence — the only hits are their own definitions
  • Note index.ts does not re-export them

Proposed fix

Delete replaceLog and silence. Keep per-instance logger injection as the only way to control SDK logging.

While in the file: warn forwards to warning on InternalLog and is untested — worth a one-line test if the alias is being kept.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions