@marmeon/log
v0.3.0
Published
The logger of Marmeon apps: pino behind the framework contract, pretty in development, JSON in production.
Readme
@marmeon/log
The logger of Marmeon apps: pino behind the core's Logger contract — readable in development, JSON lines in production, with
the request's and the job's context in every entry and secrets redacted.
Installation
Part of every new Marmeon app: pnpm create marmeon installs it.
Writing log entries
import { Logger } from '@marmeon/core';
export class NoteImporter {
readonly #logger: Logger;
constructor(logger: Logger) {
this.#logger = logger;
}
async import(userId: number, rows: readonly string[]): Promise<void> {
this.#logger.info('Notes imported', { userId, count: rows.length });
}
}Keep the message fixed and put the values into the context, so a log shipper can group and search the entries.
Documentation
MIT · part of Marmeon
