@practica/create-node-app
Version:
Create Node.js app that is packed with best practices AND strive for simplicity
58 lines (51 loc) • 1.32 kB
text/typescript
import { pino, Logger as PinoLoggerImpl, DestinationStream } from 'pino';
import { LOG_LEVELS, Logger } from './definition';
export default class PinoLogger implements Logger {
readonly
constructor(
private level: LOG_LEVELS,
private prettyPrintEnabled: boolean,
private destStream?: DestinationStream | string
) {
this.
level,
transport: prettyPrintEnabled
? {
target: 'pino-pretty',
options: {
colorize: true,
sync: true,
},
}
: undefined,
});
}
debug(message: string, metadata?: object): void {
if (metadata) {
this.
} else {
this.
}
}
error(message: string, metadata?: object): void {
if (metadata) {
this.
} else {
this.
}
}
info(message: string, metadata?: object): void {
if (metadata) {
this.
} else {
this.
}
}
warning(message: string, metadata?: object): void {
if (metadata) {
this.
} else {
this.
}
}
}