skedyul 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-stamp +1 -1
- package/dist/server/context-logger.js +35 -11
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1771569422848
|
|
@@ -20,7 +20,32 @@ function getLogContext() {
|
|
|
20
20
|
return logContextStorage.getStore();
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Safely stringify a value for logging.
|
|
24
|
+
* Handles circular references and errors gracefully.
|
|
25
|
+
*/
|
|
26
|
+
function safeStringify(value) {
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
return 'undefined';
|
|
29
|
+
if (value === null)
|
|
30
|
+
return 'null';
|
|
31
|
+
if (typeof value === 'string')
|
|
32
|
+
return value;
|
|
33
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
34
|
+
return String(value);
|
|
35
|
+
if (value instanceof Error) {
|
|
36
|
+
return `${value.name}: ${value.message}${value.stack ? `\n${value.stack}` : ''}`;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return JSON.stringify(value);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return String(value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Formats a log message with invocation context prepended as JSON.
|
|
47
|
+
* All arguments are stringified into a single line to ensure the context
|
|
48
|
+
* prefix appears on every line in Docker/CloudWatch logs.
|
|
24
49
|
*/
|
|
25
50
|
function formatLogWithContext(args) {
|
|
26
51
|
const context = getLogContext();
|
|
@@ -37,16 +62,15 @@ function formatLogWithContext(args) {
|
|
|
37
62
|
...(context.invocation.workflowId && { workflowId: context.invocation.workflowId }),
|
|
38
63
|
...(context.invocation.workflowRunId && { workflowRunId: context.invocation.workflowRunId }),
|
|
39
64
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return [contextPrefix, ...args];
|
|
65
|
+
const prefix = `[${JSON.stringify(contextPrefix)}]`;
|
|
66
|
+
// Stringify all arguments into a single line to ensure context appears on every log line
|
|
67
|
+
// This prevents multi-line object formatting from splitting logs across lines
|
|
68
|
+
const messageParts = args.map(arg => {
|
|
69
|
+
if (typeof arg === 'string')
|
|
70
|
+
return arg;
|
|
71
|
+
return safeStringify(arg);
|
|
72
|
+
});
|
|
73
|
+
return [`${prefix} ${messageParts.join(' ')}`];
|
|
50
74
|
}
|
|
51
75
|
// Store original console methods
|
|
52
76
|
const originalConsole = {
|