Stringify objects in the details field of logger config

This commit is contained in:
Alex Holliday committed 2024-10-31 16:01:04 +08:00
1 parent 120296763b
commit 3fc79d47ba
1 file changed
+4
+4
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})`);