mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 22:17:30 -07:00
parent
5ffd370b3c
commit
2ba2b941a1
2 changed files with 8 additions and 4 deletions
|
@ -66,7 +66,9 @@ if (!program.quiet) {
|
||||||
|
|
||||||
// Display detail of uncaught exception
|
// Display detail of uncaught exception
|
||||||
process.on('uncaughtException', err => {
|
process.on('uncaughtException', err => {
|
||||||
|
try {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
|
} catch { }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dying away...
|
// Dying away...
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default class Logger {
|
||||||
level === 'info' ? this.syslogClient.info :
|
level === 'info' ? this.syslogClient.info :
|
||||||
null as never;
|
null as never;
|
||||||
|
|
||||||
send.bind(this.syslogClient)(message);
|
send.bind(this.syslogClient)(message).catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
const Logs = getRepository(Log);
|
const Logs = getRepository(Log);
|
||||||
Logs.insert({
|
Logs.insert({
|
||||||
|
@ -106,7 +106,7 @@ export default class Logger {
|
||||||
level: level,
|
level: level,
|
||||||
message: message.substr(0, 1000), // 1024を超えるとログが挿入できずエラーになり無限ループする
|
message: message.substr(0, 1000), // 1024を超えるとログが挿入できずエラーになり無限ループする
|
||||||
data: data,
|
data: data,
|
||||||
} as Log);
|
} as Log).catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,8 +116,10 @@ export default class Logger {
|
||||||
data = data || {};
|
data = data || {};
|
||||||
data.e = x;
|
data.e = x;
|
||||||
this.log('error', x.toString(), data, important);
|
this.log('error', x.toString(), data, important);
|
||||||
|
} else if (typeof x === 'object') {
|
||||||
|
this.log('error', `${(x as any).message || (x as any).name || x}`, data, important);
|
||||||
} else {
|
} else {
|
||||||
this.log('error', x, data, important);
|
this.log('error', `${x}`, data, important);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue