@takeshape/logger 11.97.6 → 11.98.6
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/logger.js +8 -3
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/logger.js
CHANGED
|
@@ -63,7 +63,7 @@ function getJsonLog({ level, message, metadata, requestId, error }, emfFn) {
|
|
|
63
63
|
level,
|
|
64
64
|
timestamp: new Date(now).toISOString(),
|
|
65
65
|
requestId,
|
|
66
|
-
...metadata
|
|
66
|
+
...(!metadata.messageOnly ? metadata : undefined)
|
|
67
67
|
};
|
|
68
68
|
if (error) {
|
|
69
69
|
jsonLog = {
|
|
@@ -206,9 +206,14 @@ function decorateLogFn({ provider, level, sentryClient }, entry) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
if (provider === 'CONSOLE') {
|
|
209
|
-
const consoleMethod = level.toLowerCase();
|
|
210
209
|
// biome-ignore lint/suspicious/noConsole: allowed
|
|
211
|
-
console[
|
|
210
|
+
const consoleMethod = console[level.toLowerCase()];
|
|
211
|
+
if (!metadata?.messageOnly) {
|
|
212
|
+
consoleMethod(messageOrError, metadata);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
consoleMethod(messageOrError);
|
|
216
|
+
}
|
|
212
217
|
return;
|
|
213
218
|
}
|
|
214
219
|
const jsonLog = getJsonLog({
|
package/dist/types.d.ts
CHANGED
|
@@ -136,6 +136,14 @@ export type LogContext = {
|
|
|
136
136
|
*/
|
|
137
137
|
platform?: {
|
|
138
138
|
[k: string]: any;
|
|
139
|
+
/**
|
|
140
|
+
* A boolean indicating if the application is running in a "live" SST environment (sst dev + live whitelist).
|
|
141
|
+
*/
|
|
142
|
+
isLive?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* A boolean indicating if the application is running in a dev SST environment (sst dev).
|
|
145
|
+
*/
|
|
146
|
+
isDev?: boolean;
|
|
139
147
|
/**
|
|
140
148
|
* Contextual information about the service running on the Fargate
|
|
141
149
|
*/
|
|
@@ -285,6 +293,10 @@ export type LogEntry = {
|
|
|
285
293
|
* A controlled representation of the event this log line represents.
|
|
286
294
|
*/
|
|
287
295
|
event?: LogEvent | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* Only print the message line, not the metadata.
|
|
298
|
+
*/
|
|
299
|
+
messageOnly?: boolean;
|
|
288
300
|
};
|
|
289
301
|
export type LogMetadata = {
|
|
290
302
|
error?: Error;
|