mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 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",
|
"colorInfo": "#5865F2",
|
||||||
"colorNote": "#80848E"
|
"colorNote": "#80848E"
|
||||||
},
|
},
|
||||||
"minimumLogLevel": "info",
|
"minimumLogLevel": "debug",
|
||||||
|
"minimumLogLevelConsole": "info",
|
||||||
"filterThreadAmount": "4",
|
"filterThreadAmount": "4",
|
||||||
"filterList": [
|
"filterList": [
|
||||||
{
|
{
|
||||||
|
|||||||
+31
-8
@@ -1,12 +1,35 @@
|
|||||||
const pino = require('pino');
|
const pino = require('pino');
|
||||||
const { minimumLogLevel } = require('../config.json');
|
const { minimumLogLevel, minimumLogLevelConsole } = require('../config.json');
|
||||||
|
|
||||||
module.exports = pino({
|
const transport = pino.transport({
|
||||||
level: minimumLogLevel,
|
targets: [
|
||||||
transport: {
|
{
|
||||||
target: 'pino-pretty',
|
target: 'pino/file',
|
||||||
options: {
|
level: 'debug',
|
||||||
ignore: 'pid,hostname'
|
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