UNPKG

pinetto

Version:

Isomorphic, opinionated logging library focusing on simplicity and readability. Supports child loggers.

34 lines 920 B
export class ChildLogger { #prefix; _methods; constructor(opts) { const { prefix, methods } = opts; this.#prefix = prefix; this._methods = methods; } get level() { return this._methods.level; } error(message, ...args) { this._methods.error(this.#prefix, message, args); } warn(message, ...args) { this._methods.warn(this.#prefix, message, args); } info(message, ...args) { this._methods.info(this.#prefix, message, args); } debug(message, ...args) { this._methods.debug(this.#prefix, message, args); } trace(message, ...args) { this._methods.trace(this.#prefix, message, args); } child(prefix) { return new ChildLogger({ methods: this._methods, prefix: `${this.#prefix.slice(0, -1)}${prefix} `, }); } } //# sourceMappingURL=child.js.map