mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
feat: Log events to file based on log level
This commit is contained in:
1 parent
cf2aa06f39
commit
6bb602ebbb
2 files changed
+33
-9
No files matched your search
+2
-1
@@ -10,7 +10,8 @@
|
||||
"colorInfo": "#5865F2",
|
||||
"colorNote": "#80848E"
|
||||
},
|
||||
"minimumLogLevel": "info",
|
||||
"minimumLogLevel": "debug",
|
||||
"minimumLogLevelConsole": "info",
|
||||
"filterThreadAmount": "4",
|
||||
"filterList": [
|
||||
{
|
||||
|
||||
+31
-8
@@ -1,12 +1,35 @@
|
||||
const pino = require('pino');
|
||||
const { minimumLogLevel } = require('../config.json');
|
||||
const { minimumLogLevel, minimumLogLevelConsole } = require('../config.json');
|
||||
|
||||
module.exports = pino({
|
||||
level: minimumLogLevel,
|
||||
transport: {
|
||||
target: 'pino-pretty',
|
||||
options: {
|
||||
ignore: 'pid,hostname'
|
||||
const transport = pino.transport({
|
||||
targets: [
|
||||
{
|
||||
target: 'pino/file',
|
||||
level: 'debug',
|
||||
options: { destination: `./app-debug.log` }
|
||||
},
|
||||
{
|
||||
target: 'pino/file',
|
||||
level: 'info',
|
||||
options: { destination: `./app-info.log` }
|
||||
},
|
||||
{
|
||||
target: 'pino/file',
|
||||
level: 'error',
|
||||
options: { destination: `./app-error.log` }
|
||||
},
|
||||
{
|
||||
level: minimumLogLevelConsole,
|
||||
target: 'pino-pretty'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
module.exports = pino(
|
||||
{
|
||||
level: minimumLogLevel,
|
||||
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
|
||||
base: undefined
|
||||
},
|
||||
transport
|
||||
);
|
||||
Reference in new issue
Block a user