pino
Installation
SKILL.md
Apply these conventions when working with pino logging code.
Logger Creation
- Create with
pino(options, destination). Both arguments are optional. - Key options:
level(default'info'),name,base(default{pid, hostname}— set toundefinedto omit),timestamp(defaulttrue),messageKey(default'msg'),errorKey(default'err'). - Use
enabled: falseto disable logging entirely (e.g., in tests). - Use
nestedKeyto namespace logged objects and avoid key collisions with the log envelope.
Log Levels
- Built-in levels:
trace(10),debug(20),info(30),warn(40),error(50),fatal(60),silent(Infinity). - Method signature:
logger.info([mergingObject], [message], [...interpolationValues]). - Pass the object first, message second:
logger.info({ userId: 123 }, 'user logged in')— not the other way around. - Check level before expensive work:
if (logger.isLevelEnabled('debug')) { ... }. - Custom levels:
customLevels: { audit: 35 }. UseuseOnlyCustomLevels: trueto disable built-in levels.