createLogger()
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / createLogger
Function: createLogger()
Section titled “Function: 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.
Parameters
Section titled “Parameters”module
Section titled “module”string
Module name to add to all log entries
config?
Section titled “config?”Optional additional configuration
Returns
Section titled “Returns”Child logger instance
Example
Section titled “Example”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"}