Home > @magiclane/maps-sdk > Logger

Logger class

Configurable logger for the Magic Lane Maps SDK.

Provides centralized logging with configurable levels, custom handlers, and optional timestamps. By default, only error messages are logged.

Signature:

declare class SdkLogger 

Example

// Enable debug logging
Logger.configure({ level: 'debug' });

// Use custom handler (e.g., for external logging service)
Logger.configure({
  level: 'info',
  handler: (level, msg, ...args) => myLogger.log(level, msg, ...args)
});

// Add timestamps
Logger.configure({ level: 'debug', timestamp: true });

// Disable all logging
Logger.configure({ level: 'none' });

// Reset to defaults
Logger.reset();

Core

Methods

Method

Modifiers

Description

configure(config)

static

Configure the logger settings. Settings are merged with existing configuration.

debug(message, args)

static

Log a debug message. Debug messages are for development and troubleshooting.

error(message, args)

static

Log an error message. Errors indicate serious problems that require attention.

getConfig()

static

Get a copy of the current configuration.

info(message, args)

static

Log an informational message. Info messages provide useful runtime information.

reset()

static

Reset logger to default configuration. Useful for testing or resetting after temporary changes.

warn(message, args)

static

Log a warning message. Warnings indicate potential problems that don't prevent operation.