The logger contract of the core and of every @botmesh/* package (BotConfig.logger,
store and provider logger options). pino satisfies it as is; console and any object
with these four methods work too.
Calling convention (pino style). Every call the packages make has one of two shapes:
logger.warn('message'): a plain message.
logger.warn({ err, chatId }, 'message'): a context object FIRST, then the message. An
error goes under the err key (pino serializes its stack there).
The packages never pass a message first and an object after it (pino would drop that
object), and never rely on printf placeholders. A custom logger should therefore
treat a leading object as structured context and the following string as the message.
child(bindings) is optional: without it, the bindings ({ module: 'store' }) are dropped.
The logger contract of the core and of every
@botmesh/*package (BotConfig.logger, store and providerloggeroptions). pino satisfies it as is;consoleand any object with these four methods work too.Calling convention (pino style). Every call the packages make has one of two shapes:
logger.warn('message'): a plain message.logger.warn({ err, chatId }, 'message'): a context object FIRST, then the message. An error goes under theerrkey (pino serializes its stack there).The packages never pass a message first and an object after it (pino would drop that object), and never rely on printf placeholders. A custom logger should therefore treat a leading object as structured context and the following string as the message.
child(bindings)is optional: without it, the bindings ({ module: 'store' }) are dropped.Example