feat(script): api.log now supports objects

This commit is contained in:
Elian Doran
2025-10-01 20:22:02 +03:00
parent f412874c73
commit 7cfebbabeb
4 changed files with 19 additions and 4 deletions

View File

@@ -10,3 +10,4 @@ export * from "./lib/server_api.js";
export * from "./lib/shared_constants.js";
export * from "./lib/ws_api.js";
export * from "./lib/attribute_names.js";
export * from "./lib/utils.js";

View File

@@ -0,0 +1,11 @@
export function formatLogMessage(message: string | object) {
if (typeof message === "object") {
try {
return JSON.stringify(message, null, 4);
} catch (e) {
return message.toString();
}
}
return message;
}