An ILogger that writes human-readable lines to the console, for scripts,
command-line tools and the examples, where pino's JSON lines get in the
way. Level resolution matches createDefaultLogger: the level argument,
then ESI_LOG_LEVEL, then 'warn'; 'silent' writes nothing, and an
unknown value falls back rather than throwing, since a logger must not
throw.
info lines are written as they are; every other level is prefixed with
its name (warn: ...). info and below go to console.log, warn to
console.warn, and error and fatal to console.error, so a failure
lands on standard error. Context is appended as [key=value] tokens: an
Error shows its message, a string as is, anything else as JSON.
constlog = createConsoleLogger('info'); // the program's own output constclient = newEsiClient({ logger:createConsoleLogger() }); log.info(`Players online: ${(awaitclient.status.getStatus()).players}`);
An
ILoggerthat writes human-readable lines to the console, for scripts, command-line tools and the examples, where pino's JSON lines get in the way. Level resolution matchescreateDefaultLogger: thelevelargument, thenESI_LOG_LEVEL, then'warn';'silent'writes nothing, and an unknown value falls back rather than throwing, since a logger must not throw.infolines are written as they are; every other level is prefixed with its name (warn: ...).infoand below go toconsole.log,warntoconsole.warn, anderrorandfataltoconsole.error, so a failure lands on standard error. Context is appended as[key=value]tokens: anErrorshows its message, a string as is, anything else as JSON.