Skip to main content

Overview

The SDK uses an internal logger for debug output, warnings, and errors — things like retry attempts, rate limiting, queue overflow, and plugin failures. By default, logging is silent. You can enable the built-in console logger or provide your own implementation.

Logger Interface

Both SDKs use the same Logger interface (defined in @miradorlabs/plugins):

Quick Start

Silent (Default)

No logging output. All log calls are no-ops.

Debug Mode

Enable the built-in console logger with the debug flag:
This maps to console.debug, console.warn, and console.error respectively. Useful during development — you’ll see internal SDK activity in your browser or terminal console.

Custom Logger

Pass any object that satisfies the Logger interface:
If both debug and logger are provided, the custom logger takes precedence.

What Gets Logged

Winston (Node.js)

Pino (Node.js)

Datadog Browser Logs (Web)

Conditional Logging

Log only warnings and errors in production, everything in development:

Logger in Plugins

Plugins receive the logger from TraceContext during setup(). If you’re building a custom plugin, use context.logger instead of console so your plugin respects the user’s logging configuration:

Next Steps

Lifecycle Callbacks

Monitor trace events programmatically

Retry Logic

Error handling and retry strategies