@cloud-copilot/log 0.1.38 → 0.1.40
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/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +9 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/log.d.ts +93 -2
- package/dist/cjs/log.d.ts.map +1 -1
- package/dist/cjs/log.js +103 -16
- package/dist/cjs/log.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/log.d.ts +93 -2
- package/dist/esm/log.d.ts.map +1 -1
- package/dist/esm/log.js +98 -15
- package/dist/esm/log.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isLogLevel, StandardLogger, type LogLevel } from './log';
|
|
1
|
+
export { isLogLevel, log, StandardLogger, type StandardLoggerOptions, type Logger, type LogLevel, LogLevels, normalizeArgs, type NormalizedLogArgs, setLogger, getLogger } from './log.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,SAAS,EACT,aAAa,EACb,KAAK,iBAAiB,EACtB,SAAS,EACT,SAAS,EACV,MAAM,UAAU,CAAA"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StandardLogger = exports.isLogLevel = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "isLogLevel", { enumerable: true, get: function () { return
|
|
6
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.getLogger = exports.setLogger = exports.normalizeArgs = exports.LogLevels = exports.StandardLogger = exports.log = exports.isLogLevel = void 0;
|
|
4
|
+
var log_js_1 = require("./log.js");
|
|
5
|
+
Object.defineProperty(exports, "isLogLevel", { enumerable: true, get: function () { return log_js_1.isLogLevel; } });
|
|
6
|
+
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return log_js_1.log; } });
|
|
7
|
+
Object.defineProperty(exports, "StandardLogger", { enumerable: true, get: function () { return log_js_1.StandardLogger; } });
|
|
8
|
+
Object.defineProperty(exports, "LogLevels", { enumerable: true, get: function () { return log_js_1.LogLevels; } });
|
|
9
|
+
Object.defineProperty(exports, "normalizeArgs", { enumerable: true, get: function () { return log_js_1.normalizeArgs; } });
|
|
10
|
+
Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return log_js_1.setLogger; } });
|
|
11
|
+
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return log_js_1.getLogger; } });
|
|
7
12
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAYiB;AAXf,oGAAA,UAAU,OAAA;AACV,6FAAA,GAAG,OAAA;AACH,wGAAA,cAAc,OAAA;AAId,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AAEb,mGAAA,SAAS,OAAA;AACT,mGAAA,SAAS,OAAA"}
|
package/dist/cjs/log.d.ts
CHANGED
|
@@ -7,16 +7,62 @@ export type LogLevel = (typeof LogLevels)[number];
|
|
|
7
7
|
* @returns true if the string is a valid log level, false otherwise
|
|
8
8
|
*/
|
|
9
9
|
export declare function isLogLevel(level: string | LogLevel): level is LogLevel;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A structured logger that outputs JSON log entries to the console.
|
|
12
|
+
* Accepts variadic arguments of mixed types: strings are joined as the message,
|
|
13
|
+
* objects are merged as context, and Errors are serialized into the entry.
|
|
14
|
+
*/
|
|
15
|
+
export interface Logger {
|
|
16
|
+
/** Log at error level. */
|
|
11
17
|
error: (...args: unknown[]) => void;
|
|
18
|
+
/** Log at warn level. */
|
|
12
19
|
warn: (...args: unknown[]) => void;
|
|
20
|
+
/** Log at info level. */
|
|
13
21
|
info: (...args: unknown[]) => void;
|
|
22
|
+
/** Log at debug level. */
|
|
14
23
|
debug: (...args: unknown[]) => void;
|
|
24
|
+
/** Log at trace level. */
|
|
15
25
|
trace: (...args: unknown[]) => void;
|
|
16
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Options for constructing a StandardLogger.
|
|
29
|
+
*/
|
|
30
|
+
export interface StandardLoggerOptions {
|
|
31
|
+
/** The initial log level. Defaults to 'warn'. */
|
|
32
|
+
logLevel?: LogLevel;
|
|
33
|
+
/**
|
|
34
|
+
* When true, outputs raw objects instead of JSON.stringify for environments
|
|
35
|
+
* like CloudWatch Logs where each log line is expected to be a JSON object.
|
|
36
|
+
* Defaults to false.
|
|
37
|
+
*/
|
|
38
|
+
rawJsonLogs?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A logger that outputs structured JSON to the console.
|
|
42
|
+
* Supports configurable log levels, raw JSON output for CloudWatch,
|
|
43
|
+
* and variadic arguments with mixed types.
|
|
44
|
+
*/
|
|
17
45
|
export declare class StandardLogger implements Logger {
|
|
18
46
|
private logLevel;
|
|
47
|
+
private rawJsonLogs;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new StandardLogger.
|
|
50
|
+
*
|
|
51
|
+
* @param initialLogLevel - The initial log level (backward-compatible positional form)
|
|
52
|
+
*/
|
|
19
53
|
constructor(initialLogLevel?: LogLevel);
|
|
54
|
+
/**
|
|
55
|
+
* Create a new StandardLogger with options.
|
|
56
|
+
*
|
|
57
|
+
* @param options - Configuration options for the logger
|
|
58
|
+
*/
|
|
59
|
+
constructor(options: StandardLoggerOptions);
|
|
60
|
+
/**
|
|
61
|
+
* Update the log level.
|
|
62
|
+
*
|
|
63
|
+
* @param level - The new log level to set
|
|
64
|
+
* @throws Error if the provided level is not a valid log level
|
|
65
|
+
*/
|
|
20
66
|
setLogLevel(level: LogLevel): void;
|
|
21
67
|
error(...args: unknown[]): void;
|
|
22
68
|
warn(...args: unknown[]): void;
|
|
@@ -24,5 +70,50 @@ export declare class StandardLogger implements Logger {
|
|
|
24
70
|
debug(...args: unknown[]): void;
|
|
25
71
|
trace(...args: unknown[]): void;
|
|
26
72
|
}
|
|
27
|
-
|
|
73
|
+
/**
|
|
74
|
+
* The result of normalizing variadic log arguments into structured parts.
|
|
75
|
+
*/
|
|
76
|
+
export interface NormalizedLogArgs {
|
|
77
|
+
/** All string arguments joined with spaces. */
|
|
78
|
+
message: string;
|
|
79
|
+
/** All non-Error object arguments merged together. */
|
|
80
|
+
context: Record<string, unknown>;
|
|
81
|
+
/** All Error arguments, normalized to a consistent shape. */
|
|
82
|
+
errors: {
|
|
83
|
+
name: string;
|
|
84
|
+
message: string;
|
|
85
|
+
stack?: string;
|
|
86
|
+
code?: unknown;
|
|
87
|
+
}[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Normalize variadic log arguments into structured parts.
|
|
91
|
+
* Separates string args (joined as message), Error args (serialized), and object args (merged as context).
|
|
92
|
+
* This is useful for adapters that need to convert cloud-copilot's variadic log calls
|
|
93
|
+
* into structured `(message, context)` calls for other logging frameworks.
|
|
94
|
+
*
|
|
95
|
+
* @param args - The variadic arguments passed to a log method
|
|
96
|
+
* @returns The normalized parts: message, context, and errors
|
|
97
|
+
*/
|
|
98
|
+
export declare function normalizeArgs(args: unknown[]): NormalizedLogArgs;
|
|
99
|
+
/**
|
|
100
|
+
* Replace the current module-level logger with a custom implementation.
|
|
101
|
+
* Call this at application startup to inject your own logger (e.g. an adapter
|
|
102
|
+
* that bridges to another logging framework).
|
|
103
|
+
*
|
|
104
|
+
* @param logger - The logger implementation to use
|
|
105
|
+
*/
|
|
106
|
+
export declare function setLogger(logger: Logger): void;
|
|
107
|
+
/**
|
|
108
|
+
* Get the current module-level logger.
|
|
109
|
+
*
|
|
110
|
+
* @returns The current logger instance (default: StandardLogger)
|
|
111
|
+
*/
|
|
112
|
+
export declare function getLogger(): Logger;
|
|
113
|
+
/**
|
|
114
|
+
* A proxy object that delegates all log calls to the current module-level logger.
|
|
115
|
+
* Use this for convenient access: `log.info('message', { context })`.
|
|
116
|
+
* The underlying logger can be swapped at runtime via `setLogger()`.
|
|
117
|
+
*/
|
|
118
|
+
export declare const log: Logger;
|
|
28
119
|
//# sourceMappingURL=log.d.ts.map
|
package/dist/cjs/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,sDAAuD,CAAA;AAE7E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAUjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,IAAI,QAAQ,CAEtE;AAED,
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,sDAAuD,CAAA;AAE7E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;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;CAGzB;AAeD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,6DAA6D;IAC7D,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAehE;AA4FD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAAE,MAMjB,CAAA"}
|
package/dist/cjs/log.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StandardLogger = exports.LogLevels = void 0;
|
|
3
|
+
exports.log = exports.StandardLogger = exports.LogLevels = void 0;
|
|
4
4
|
exports.isLogLevel = isLogLevel;
|
|
5
|
+
exports.normalizeArgs = normalizeArgs;
|
|
6
|
+
exports.setLogger = setLogger;
|
|
7
|
+
exports.getLogger = getLogger;
|
|
5
8
|
exports.LogLevels = ['error', 'warn', 'info', 'debug', 'trace'];
|
|
6
9
|
const LEVELS = {
|
|
7
10
|
error: 0,
|
|
@@ -19,16 +22,32 @@ const LEVELS = {
|
|
|
19
22
|
function isLogLevel(level) {
|
|
20
23
|
return level !== undefined && LEVELS.hasOwnProperty(level);
|
|
21
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A logger that outputs structured JSON to the console.
|
|
27
|
+
* Supports configurable log levels, raw JSON output for CloudWatch,
|
|
28
|
+
* and variadic arguments with mixed types.
|
|
29
|
+
*/
|
|
22
30
|
class StandardLogger {
|
|
23
31
|
logLevel;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
rawJsonLogs;
|
|
33
|
+
constructor(arg) {
|
|
34
|
+
const envRawJsonLogs = typeof process !== 'undefined' &&
|
|
35
|
+
process.env?.IAM_COLLECT_RAW_JSON_LOGS?.toLowerCase() === 'true';
|
|
36
|
+
if (typeof arg === 'object' && arg !== null) {
|
|
37
|
+
this.logLevel = arg.logLevel && isLogLevel(arg.logLevel) ? arg.logLevel : 'warn';
|
|
38
|
+
this.rawJsonLogs = arg.rawJsonLogs ?? envRawJsonLogs;
|
|
27
39
|
}
|
|
28
40
|
else {
|
|
29
|
-
this.logLevel = 'warn';
|
|
41
|
+
this.logLevel = arg && isLogLevel(arg) ? arg : 'warn';
|
|
42
|
+
this.rawJsonLogs = envRawJsonLogs;
|
|
30
43
|
}
|
|
31
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Update the log level.
|
|
47
|
+
*
|
|
48
|
+
* @param level - The new log level to set
|
|
49
|
+
* @throws Error if the provided level is not a valid log level
|
|
50
|
+
*/
|
|
32
51
|
setLogLevel(level) {
|
|
33
52
|
if (!isLogLevel(level)) {
|
|
34
53
|
throw new Error(`Invalid log level: ${level}`);
|
|
@@ -36,22 +55,55 @@ class StandardLogger {
|
|
|
36
55
|
this.logLevel = level;
|
|
37
56
|
}
|
|
38
57
|
error(...args) {
|
|
39
|
-
logAt(this.logLevel, 'error', args);
|
|
58
|
+
logAt(this.logLevel, 'error', args, this.rawJsonLogs);
|
|
40
59
|
}
|
|
41
60
|
warn(...args) {
|
|
42
|
-
logAt(this.logLevel, 'warn', args);
|
|
61
|
+
logAt(this.logLevel, 'warn', args, this.rawJsonLogs);
|
|
43
62
|
}
|
|
44
63
|
info(...args) {
|
|
45
|
-
logAt(this.logLevel, 'info', args);
|
|
64
|
+
logAt(this.logLevel, 'info', args, this.rawJsonLogs);
|
|
46
65
|
}
|
|
47
66
|
debug(...args) {
|
|
48
|
-
logAt(this.logLevel, 'debug', args);
|
|
67
|
+
logAt(this.logLevel, 'debug', args, this.rawJsonLogs);
|
|
49
68
|
}
|
|
50
69
|
trace(...args) {
|
|
51
|
-
logAt(this.logLevel, 'trace', args);
|
|
70
|
+
logAt(this.logLevel, 'trace', args, this.rawJsonLogs);
|
|
52
71
|
}
|
|
53
72
|
}
|
|
54
73
|
exports.StandardLogger = StandardLogger;
|
|
74
|
+
/**
|
|
75
|
+
* Check if an object is an Error or Error-like (has name and message properties).
|
|
76
|
+
*
|
|
77
|
+
* @param obj - The object to check
|
|
78
|
+
* @returns true if the object is an Error or Error-like
|
|
79
|
+
*/
|
|
80
|
+
function isError(obj) {
|
|
81
|
+
return (obj instanceof Error ||
|
|
82
|
+
(typeof obj === 'object' && obj !== null && 'message' in obj && 'name' in obj));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Normalize variadic log arguments into structured parts.
|
|
86
|
+
* Separates string args (joined as message), Error args (serialized), and object args (merged as context).
|
|
87
|
+
* This is useful for adapters that need to convert cloud-copilot's variadic log calls
|
|
88
|
+
* into structured `(message, context)` calls for other logging frameworks.
|
|
89
|
+
*
|
|
90
|
+
* @param args - The variadic arguments passed to a log method
|
|
91
|
+
* @returns The normalized parts: message, context, and errors
|
|
92
|
+
*/
|
|
93
|
+
function normalizeArgs(args) {
|
|
94
|
+
const messageArgs = args.filter((a) => typeof a !== 'object' || a === null);
|
|
95
|
+
const objectArgs = args.filter((a) => typeof a === 'object' && a !== null && !isError(a));
|
|
96
|
+
const errorArgs = args.filter(isError);
|
|
97
|
+
const context = {};
|
|
98
|
+
for (const obj of objectArgs) {
|
|
99
|
+
Object.assign(context, obj);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
message: serializeArgs(messageArgs),
|
|
103
|
+
context,
|
|
104
|
+
errors: errorArgs.map(mapError)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
55
107
|
// helper to serialize non-object args into a single string
|
|
56
108
|
function serializeArgs(args) {
|
|
57
109
|
return args
|
|
@@ -64,10 +116,6 @@ function serializeArgs(args) {
|
|
|
64
116
|
: JSON.stringify(a))
|
|
65
117
|
.join(' ');
|
|
66
118
|
}
|
|
67
|
-
function isError(obj) {
|
|
68
|
-
return (obj instanceof Error ||
|
|
69
|
-
(typeof obj === 'object' && obj !== null && 'message' in obj && 'name' in obj));
|
|
70
|
-
}
|
|
71
119
|
/**
|
|
72
120
|
* Map an Error object to a consistent shape.
|
|
73
121
|
*
|
|
@@ -85,7 +133,7 @@ function mapError(e) {
|
|
|
85
133
|
};
|
|
86
134
|
}
|
|
87
135
|
// core log function: level check → prefix → JSON output
|
|
88
|
-
function logAt(currentLevel, level, args) {
|
|
136
|
+
function logAt(currentLevel, level, args, rawJsonLogs) {
|
|
89
137
|
if (LEVELS[level] > LEVELS[currentLevel])
|
|
90
138
|
return;
|
|
91
139
|
// Base log entry
|
|
@@ -112,7 +160,14 @@ function logAt(currentLevel, level, args) {
|
|
|
112
160
|
entry.errors = errorArgs.map(mapError);
|
|
113
161
|
}
|
|
114
162
|
}
|
|
115
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Raw JSON logging is great for things like CloudWatch Logs where each log line
|
|
165
|
+
* is expected to be a single JSON object for easier parsing and querying.
|
|
166
|
+
*
|
|
167
|
+
* The default is JSON.stringify for each log line as a single line for processing
|
|
168
|
+
* with bash and other command-line tools.
|
|
169
|
+
*/
|
|
170
|
+
const line = rawJsonLogs ? entry : JSON.stringify(entry);
|
|
116
171
|
switch (level) {
|
|
117
172
|
case 'error':
|
|
118
173
|
return console.error(line);
|
|
@@ -124,4 +179,36 @@ function logAt(currentLevel, level, args) {
|
|
|
124
179
|
return console.log(line);
|
|
125
180
|
}
|
|
126
181
|
}
|
|
182
|
+
// ── Module-level logger singleton ──────────────────────────────────────────────
|
|
183
|
+
let currentLogger = new StandardLogger();
|
|
184
|
+
/**
|
|
185
|
+
* Replace the current module-level logger with a custom implementation.
|
|
186
|
+
* Call this at application startup to inject your own logger (e.g. an adapter
|
|
187
|
+
* that bridges to another logging framework).
|
|
188
|
+
*
|
|
189
|
+
* @param logger - The logger implementation to use
|
|
190
|
+
*/
|
|
191
|
+
function setLogger(logger) {
|
|
192
|
+
currentLogger = logger;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get the current module-level logger.
|
|
196
|
+
*
|
|
197
|
+
* @returns The current logger instance (default: StandardLogger)
|
|
198
|
+
*/
|
|
199
|
+
function getLogger() {
|
|
200
|
+
return currentLogger;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* A proxy object that delegates all log calls to the current module-level logger.
|
|
204
|
+
* Use this for convenient access: `log.info('message', { context })`.
|
|
205
|
+
* The underlying logger can be swapped at runtime via `setLogger()`.
|
|
206
|
+
*/
|
|
207
|
+
exports.log = {
|
|
208
|
+
error: (...args) => currentLogger.error(...args),
|
|
209
|
+
warn: (...args) => currentLogger.warn(...args),
|
|
210
|
+
info: (...args) => currentLogger.info(...args),
|
|
211
|
+
debug: (...args) => currentLogger.debug(...args),
|
|
212
|
+
trace: (...args) => currentLogger.trace(...args)
|
|
213
|
+
};
|
|
127
214
|
//# sourceMappingURL=log.js.map
|
package/dist/cjs/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":";;;AAkBA,gCAEC;
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":";;;AAkBA,gCAEC;AAqID,sCAeC;AAmGD,8BAEC;AAOD,8BAEC;AAtRY,QAAA,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,CAAA;AAI7E,MAAM,MAAM,GAA6B;IACvC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AAC,GAAG,IAAI,CAAC;IACzD,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAC3D,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CAC5D,CAAA"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isLogLevel, StandardLogger, type LogLevel } from './log';
|
|
1
|
+
export { isLogLevel, log, StandardLogger, type StandardLoggerOptions, type Logger, type LogLevel, LogLevels, normalizeArgs, type NormalizedLogArgs, setLogger, getLogger } from './log.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,SAAS,EACT,aAAa,EACb,KAAK,iBAAiB,EACtB,SAAS,EACT,SAAS,EACV,MAAM,UAAU,CAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isLogLevel, StandardLogger } from './log';
|
|
1
|
+
export { isLogLevel, log, StandardLogger, LogLevels, normalizeArgs, setLogger, getLogger } from './log.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,GAAG,EACH,cAAc,EAId,SAAS,EACT,aAAa,EAEb,SAAS,EACT,SAAS,EACV,MAAM,UAAU,CAAA"}
|
package/dist/esm/log.d.ts
CHANGED
|
@@ -7,16 +7,62 @@ export type LogLevel = (typeof LogLevels)[number];
|
|
|
7
7
|
* @returns true if the string is a valid log level, false otherwise
|
|
8
8
|
*/
|
|
9
9
|
export declare function isLogLevel(level: string | LogLevel): level is LogLevel;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A structured logger that outputs JSON log entries to the console.
|
|
12
|
+
* Accepts variadic arguments of mixed types: strings are joined as the message,
|
|
13
|
+
* objects are merged as context, and Errors are serialized into the entry.
|
|
14
|
+
*/
|
|
15
|
+
export interface Logger {
|
|
16
|
+
/** Log at error level. */
|
|
11
17
|
error: (...args: unknown[]) => void;
|
|
18
|
+
/** Log at warn level. */
|
|
12
19
|
warn: (...args: unknown[]) => void;
|
|
20
|
+
/** Log at info level. */
|
|
13
21
|
info: (...args: unknown[]) => void;
|
|
22
|
+
/** Log at debug level. */
|
|
14
23
|
debug: (...args: unknown[]) => void;
|
|
24
|
+
/** Log at trace level. */
|
|
15
25
|
trace: (...args: unknown[]) => void;
|
|
16
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Options for constructing a StandardLogger.
|
|
29
|
+
*/
|
|
30
|
+
export interface StandardLoggerOptions {
|
|
31
|
+
/** The initial log level. Defaults to 'warn'. */
|
|
32
|
+
logLevel?: LogLevel;
|
|
33
|
+
/**
|
|
34
|
+
* When true, outputs raw objects instead of JSON.stringify for environments
|
|
35
|
+
* like CloudWatch Logs where each log line is expected to be a JSON object.
|
|
36
|
+
* Defaults to false.
|
|
37
|
+
*/
|
|
38
|
+
rawJsonLogs?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A logger that outputs structured JSON to the console.
|
|
42
|
+
* Supports configurable log levels, raw JSON output for CloudWatch,
|
|
43
|
+
* and variadic arguments with mixed types.
|
|
44
|
+
*/
|
|
17
45
|
export declare class StandardLogger implements Logger {
|
|
18
46
|
private logLevel;
|
|
47
|
+
private rawJsonLogs;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new StandardLogger.
|
|
50
|
+
*
|
|
51
|
+
* @param initialLogLevel - The initial log level (backward-compatible positional form)
|
|
52
|
+
*/
|
|
19
53
|
constructor(initialLogLevel?: LogLevel);
|
|
54
|
+
/**
|
|
55
|
+
* Create a new StandardLogger with options.
|
|
56
|
+
*
|
|
57
|
+
* @param options - Configuration options for the logger
|
|
58
|
+
*/
|
|
59
|
+
constructor(options: StandardLoggerOptions);
|
|
60
|
+
/**
|
|
61
|
+
* Update the log level.
|
|
62
|
+
*
|
|
63
|
+
* @param level - The new log level to set
|
|
64
|
+
* @throws Error if the provided level is not a valid log level
|
|
65
|
+
*/
|
|
20
66
|
setLogLevel(level: LogLevel): void;
|
|
21
67
|
error(...args: unknown[]): void;
|
|
22
68
|
warn(...args: unknown[]): void;
|
|
@@ -24,5 +70,50 @@ export declare class StandardLogger implements Logger {
|
|
|
24
70
|
debug(...args: unknown[]): void;
|
|
25
71
|
trace(...args: unknown[]): void;
|
|
26
72
|
}
|
|
27
|
-
|
|
73
|
+
/**
|
|
74
|
+
* The result of normalizing variadic log arguments into structured parts.
|
|
75
|
+
*/
|
|
76
|
+
export interface NormalizedLogArgs {
|
|
77
|
+
/** All string arguments joined with spaces. */
|
|
78
|
+
message: string;
|
|
79
|
+
/** All non-Error object arguments merged together. */
|
|
80
|
+
context: Record<string, unknown>;
|
|
81
|
+
/** All Error arguments, normalized to a consistent shape. */
|
|
82
|
+
errors: {
|
|
83
|
+
name: string;
|
|
84
|
+
message: string;
|
|
85
|
+
stack?: string;
|
|
86
|
+
code?: unknown;
|
|
87
|
+
}[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Normalize variadic log arguments into structured parts.
|
|
91
|
+
* Separates string args (joined as message), Error args (serialized), and object args (merged as context).
|
|
92
|
+
* This is useful for adapters that need to convert cloud-copilot's variadic log calls
|
|
93
|
+
* into structured `(message, context)` calls for other logging frameworks.
|
|
94
|
+
*
|
|
95
|
+
* @param args - The variadic arguments passed to a log method
|
|
96
|
+
* @returns The normalized parts: message, context, and errors
|
|
97
|
+
*/
|
|
98
|
+
export declare function normalizeArgs(args: unknown[]): NormalizedLogArgs;
|
|
99
|
+
/**
|
|
100
|
+
* Replace the current module-level logger with a custom implementation.
|
|
101
|
+
* Call this at application startup to inject your own logger (e.g. an adapter
|
|
102
|
+
* that bridges to another logging framework).
|
|
103
|
+
*
|
|
104
|
+
* @param logger - The logger implementation to use
|
|
105
|
+
*/
|
|
106
|
+
export declare function setLogger(logger: Logger): void;
|
|
107
|
+
/**
|
|
108
|
+
* Get the current module-level logger.
|
|
109
|
+
*
|
|
110
|
+
* @returns The current logger instance (default: StandardLogger)
|
|
111
|
+
*/
|
|
112
|
+
export declare function getLogger(): Logger;
|
|
113
|
+
/**
|
|
114
|
+
* A proxy object that delegates all log calls to the current module-level logger.
|
|
115
|
+
* Use this for convenient access: `log.info('message', { context })`.
|
|
116
|
+
* The underlying logger can be swapped at runtime via `setLogger()`.
|
|
117
|
+
*/
|
|
118
|
+
export declare const log: Logger;
|
|
28
119
|
//# sourceMappingURL=log.d.ts.map
|
package/dist/esm/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,sDAAuD,CAAA;AAE7E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAUjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,IAAI,QAAQ,CAEtE;AAED,
|
|
1
|
+
{"version":3,"file":"log.d.ts","sour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AAO,EAAE;IAGvB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAGvB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAGxB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;CAGzB;AAeD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,6DAA6D;IAC7D,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAehE;AA4FD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAAE,MAMjB,CAAA"}
|
package/dist/esm/log.js
CHANGED
|
@@ -15,15 +15,30 @@ const LEVELS = {
|
|
|
15
15
|
export function isLogLevel(level) {
|
|
16
16
|
return level !== undefined && LEVELS.hasOwnProperty(level);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A logger that outputs structured JSON to the console.
|
|
20
|
+
* Supports configurable log levels, raw JSON output for CloudWatch,
|
|
21
|
+
* and variadic arguments with mixed types.
|
|
22
|
+
*/
|
|
18
23
|
export class StandardLogger {
|
|
19
|
-
constructor(
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
constructor(arg) {
|
|
25
|
+
const envRawJsonLogs = typeof process !== 'undefined' &&
|
|
26
|
+
process.env?.IAM_COLLECT_RAW_JSON_LOGS?.toLowerCase() === 'true';
|
|
27
|
+
if (typeof arg === 'object' && arg !== null) {
|
|
28
|
+
this.logLevel = arg.logLevel && isLogLevel(arg.logLevel) ? arg.logLevel : 'warn';
|
|
29
|
+
this.rawJsonLogs = arg.rawJsonLogs ?? envRawJsonLogs;
|
|
22
30
|
}
|
|
23
31
|
else {
|
|
24
|
-
this.logLevel = 'warn';
|
|
32
|
+
this.logLevel = arg && isLogLevel(arg) ? arg : 'warn';
|
|
33
|
+
this.rawJsonLogs = envRawJsonLogs;
|
|
25
34
|
}
|
|
26
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Update the log level.
|
|
38
|
+
*
|
|
39
|
+
* @param level - The new log level to set
|
|
40
|
+
* @throws Error if the provided level is not a valid log level
|
|
41
|
+
*/
|
|
27
42
|
setLogLevel(level) {
|
|
28
43
|
if (!isLogLevel(level)) {
|
|
29
44
|
throw new Error(`Invalid log level: ${level}`);
|
|
@@ -31,21 +46,54 @@ export class StandardLogger {
|
|
|
31
46
|
this.logLevel = level;
|
|
32
47
|
}
|
|
33
48
|
error(...args) {
|
|
34
|
-
logAt(this.logLevel, 'error', args);
|
|
49
|
+
logAt(this.logLevel, 'error', args, this.rawJsonLogs);
|
|
35
50
|
}
|
|
36
51
|
warn(...args) {
|
|
37
|
-
logAt(this.logLevel, 'warn', args);
|
|
52
|
+
logAt(this.logLevel, 'warn', args, this.rawJsonLogs);
|
|
38
53
|
}
|
|
39
54
|
info(...args) {
|
|
40
|
-
logAt(this.logLevel, 'info', args);
|
|
55
|
+
logAt(this.logLevel, 'info', args, this.rawJsonLogs);
|
|
41
56
|
}
|
|
42
57
|
debug(...args) {
|
|
43
|
-
logAt(this.logLevel, 'debug', args);
|
|
58
|
+
logAt(this.logLevel, 'debug', args, this.rawJsonLogs);
|
|
44
59
|
}
|
|
45
60
|
trace(...args) {
|
|
46
|
-
logAt(this.logLevel, 'trace', args);
|
|
61
|
+
logAt(this.logLevel, 'trace', args, this.rawJsonLogs);
|
|
47
62
|
}
|
|
48
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if an object is an Error or Error-like (has name and message properties).
|
|
66
|
+
*
|
|
67
|
+
* @param obj - The object to check
|
|
68
|
+
* @returns true if the object is an Error or Error-like
|
|
69
|
+
*/
|
|
70
|
+
function isError(obj) {
|
|
71
|
+
return (obj instanceof Error ||
|
|
72
|
+
(typeof obj === 'object' && obj !== null && 'message' in obj && 'name' in obj));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Normalize variadic log arguments into structured parts.
|
|
76
|
+
* Separates string args (joined as message), Error args (serialized), and object args (merged as context).
|
|
77
|
+
* This is useful for adapters that need to convert cloud-copilot's variadic log calls
|
|
78
|
+
* into structured `(message, context)` calls for other logging frameworks.
|
|
79
|
+
*
|
|
80
|
+
* @param args - The variadic arguments passed to a log method
|
|
81
|
+
* @returns The normalized parts: message, context, and errors
|
|
82
|
+
*/
|
|
83
|
+
export function normalizeArgs(args) {
|
|
84
|
+
const messageArgs = args.filter((a) => typeof a !== 'object' || a === null);
|
|
85
|
+
const objectArgs = args.filter((a) => typeof a === 'object' && a !== null && !isError(a));
|
|
86
|
+
const errorArgs = args.filter(isError);
|
|
87
|
+
const context = {};
|
|
88
|
+
for (const obj of objectArgs) {
|
|
89
|
+
Object.assign(context, obj);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
message: serializeArgs(messageArgs),
|
|
93
|
+
context,
|
|
94
|
+
errors: errorArgs.map(mapError)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
49
97
|
// helper to serialize non-object args into a single string
|
|
50
98
|
function serializeArgs(args) {
|
|
51
99
|
return args
|
|
@@ -58,10 +106,6 @@ function serializeArgs(args) {
|
|
|
58
106
|
: JSON.stringify(a))
|
|
59
107
|
.join(' ');
|
|
60
108
|
}
|
|
61
|
-
function isError(obj) {
|
|
62
|
-
return (obj instanceof Error ||
|
|
63
|
-
(typeof obj === 'object' && obj !== null && 'message' in obj && 'name' in obj));
|
|
64
|
-
}
|
|
65
109
|
/**
|
|
66
110
|
* Map an Error object to a consistent shape.
|
|
67
111
|
*
|
|
@@ -79,7 +123,7 @@ function mapError(e) {
|
|
|
79
123
|
};
|
|
80
124
|
}
|
|
81
125
|
// core log function: level check → prefix → JSON output
|
|
82
|
-
function logAt(currentLevel, level, args) {
|
|
126
|
+
function logAt(currentLevel, level, args, rawJsonLogs) {
|
|
83
127
|
if (LEVELS[level] > LEVELS[currentLevel])
|
|
84
128
|
return;
|
|
85
129
|
// Base log entry
|
|
@@ -106,7 +150,14 @@ function logAt(currentLevel, level, args) {
|
|
|
106
150
|
entry.errors = errorArgs.map(mapError);
|
|
107
151
|
}
|
|
108
152
|
}
|
|
109
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Raw JSON logging is great for things like CloudWatch Logs where each log line
|
|
155
|
+
* is expected to be a single JSON object for easier parsing and querying.
|
|
156
|
+
*
|
|
157
|
+
* The default is JSON.stringify for each log line as a single line for processing
|
|
158
|
+
* with bash and other command-line tools.
|
|
159
|
+
*/
|
|
160
|
+
const line = rawJsonLogs ? entry : JSON.stringify(entry);
|
|
110
161
|
switch (level) {
|
|
111
162
|
case 'error':
|
|
112
163
|
return console.error(line);
|
|
@@ -118,4 +169,36 @@ function logAt(currentLevel, level, args) {
|
|
|
118
169
|
return console.log(line);
|
|
119
170
|
}
|
|
120
171
|
}
|
|
172
|
+
// ── Module-level logger singleton ──────────────────────────────────────────────
|
|
173
|
+
let currentLogger = new StandardLogger();
|
|
174
|
+
/**
|
|
175
|
+
* Replace the current module-level logger with a custom implementation.
|
|
176
|
+
* Call this at application startup to inject your own logger (e.g. an adapter
|
|
177
|
+
* that bridges to another logging framework).
|
|
178
|
+
*
|
|
179
|
+
* @param logger - The logger implementation to use
|
|
180
|
+
*/
|
|
181
|
+
export function setLogger(logger) {
|
|
182
|
+
currentLogger = logger;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get the current module-level logger.
|
|
186
|
+
*
|
|
187
|
+
* @returns The current logger instance (default: StandardLogger)
|
|
188
|
+
*/
|
|
189
|
+
export function getLogger() {
|
|
190
|
+
return currentLogger;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A proxy object that delegates all log calls to the current module-level logger.
|
|
194
|
+
* Use this for convenient access: `log.info('message', { context })`.
|
|
195
|
+
* The underlying logger can be swapped at runtime via `setLogger()`.
|
|
196
|
+
*/
|
|
197
|
+
export const log = {
|
|
198
|
+
error: (...args) => currentLogger.error(...args),
|
|
199
|
+
warn: (...args) => currentLogger.warn(...args),
|
|
200
|
+
info: (...args) => currentLogger.info(...args),
|
|
201
|
+
debug: (...args) => currentLogger.debug(...args),
|
|
202
|
+
trace: (...args) => currentLogger.trace(...args)
|
|
203
|
+
};
|
|
121
204
|
//# sourceMappingURL=log.js.map
|
package/dist/esm/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,CAAA;AAI7E,MAAM,MAAM,GAA6B;IACvC,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;CACT,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAwB;IACjD,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC;
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,CAA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