Stringify objects in the details field of logger config

This commit is contained in:
Alex Holliday
2024-10-31 16:01:04 +08:00
parent 120296763b
commit 3fc79d47ba

View File

@@ -7,6 +7,10 @@ class Logger {
if (message instanceof Object) {
message = JSON.stringify(message, null, 2);
}
if (details instanceof Object) {
details = JSON.stringify(details, null, 2);
}
let msg = `${timestamp} ${level}:`;
service && (msg += ` [${service}]`);
method && (msg += `(${method})`);