Skip to content

createLogger()

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / createLogger

createLogger(module, config?): PinoLogger

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:22642

Create a child logger for a specific module

Child loggers inherit the parent’s configuration and add a ‘module’ field to all log entries.

string

Module name to add to all log entries

SIPLoggerConfig

Optional additional configuration

PinoLogger

Child logger instance

import { createLogger } from '@sip-protocol/sdk'
const log = createLogger('stealth')
log.info('Generating stealth address')
// Output: {"level":"info","time":"...","module":"stealth","msg":"Generating stealth address"}
log.warn({ deprecated: 'oldFunc', replacement: 'newFunc' }, 'Function deprecated')
// Output: {"level":"warn","time":"...","module":"stealth","deprecated":"oldFunc","replacement":"newFunc","msg":"Function deprecated"}