fix: pino worker error
This commit is contained in:
@@ -1,13 +1,5 @@
|
|||||||
import pino from 'pino';
|
import pino from 'pino';
|
||||||
import pretty from 'pino-pretty';
|
import pretty from 'pino-pretty';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const fileLogger = pino({
|
|
||||||
transport: {
|
|
||||||
target: 'pino/file',
|
|
||||||
options: { destination: path.join(process.cwd(), 'config', 'app.log') },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const consoleLogger = pino(
|
const consoleLogger = pino(
|
||||||
pretty({
|
pretty({
|
||||||
@@ -18,15 +10,12 @@ const consoleLogger = pino(
|
|||||||
|
|
||||||
const logger = {
|
const logger = {
|
||||||
info: (msg: string, ...args: any[]) => {
|
info: (msg: string, ...args: any[]) => {
|
||||||
fileLogger.info(msg, ...args);
|
|
||||||
consoleLogger.info(msg, ...args);
|
consoleLogger.info(msg, ...args);
|
||||||
},
|
},
|
||||||
error: (msg: string, ...args: any[]) => {
|
error: (msg: string, ...args: any[]) => {
|
||||||
fileLogger.error(msg, ...args);
|
|
||||||
consoleLogger.error(msg, ...args);
|
consoleLogger.error(msg, ...args);
|
||||||
},
|
},
|
||||||
warn: (msg: string, ...args: any[]) => {
|
warn: (msg: string, ...args: any[]) => {
|
||||||
fileLogger.warn(msg, ...args);
|
|
||||||
consoleLogger.warn(msg, ...args);
|
consoleLogger.warn(msg, ...args);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user