@serverless/sdk
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -5,2 +5,8 @@ # Changelog | ||
### [0.5.5](https://github.com/serverless/console/compare/@serverless/sdk@0.5.4...@serverless/sdk@0.5.5) (2023-04-06) | ||
### Maintenance Improvements | ||
- Write JSON strings as structured logs ([e5f5162](https://github.com/serverless/console/commit/e5f51629ea079308559c343937f27280949ec9ab)) | ||
### [0.5.4](https://github.com/serverless/console/compare/@serverless/sdk@0.5.3...@serverless/sdk@0.5.4) (2023-03-29) | ||
@@ -7,0 +13,0 @@ |
@@ -56,3 +56,3 @@ 'use strict'; | ||
if (options.fingerprint) errorLogData.fingerprint = options.fingerprint; | ||
console.error(errorLogData); | ||
console.error(JSON.stringify(errorLogData)); | ||
@@ -59,0 +59,0 @@ return capturedEvent; |
@@ -48,3 +48,3 @@ 'use strict'; | ||
if (options.fingerprint) warnLogData.fingerprint = options.fingerprint; | ||
console.warn(warnLogData); | ||
console.warn(JSON.stringify(warnLogData)); | ||
@@ -51,0 +51,0 @@ return capturedEvent; |
'use strict'; | ||
const isError = require('type/error/is'); | ||
const isPlainObject = require('type/plain-object/is'); | ||
const util = require('util'); | ||
@@ -37,3 +36,9 @@ const createErrorCapturedEvent = require('../create-error-captured-event'); | ||
const input = args[0]; | ||
if (args.length === 1 && isPlainObject(input) && input.source === 'serverlessSdk') return; | ||
if ( | ||
args.length === 1 && | ||
typeof input === 'string' && | ||
input.startsWith('{"source":"serverlessSdk",') | ||
) { | ||
return; | ||
} | ||
createErrorCapturedEvent(args.length === 1 && isError(input) ? input : resolveMessage(args), { | ||
@@ -50,3 +55,9 @@ _origin: 'nodeConsole', | ||
try { | ||
if (args.length === 1 && isPlainObject(args[0]) && args[0].source === 'serverlessSdk') return; | ||
if ( | ||
args.length === 1 && | ||
typeof args[0] === 'string' && | ||
args[0].startsWith('{"source":"serverlessSdk",') | ||
) { | ||
return; | ||
} | ||
createWarningCapturedEvent(resolveMessage(args), { _origin: 'nodeConsole' }); | ||
@@ -53,0 +64,0 @@ } catch (error) { |
@@ -31,3 +31,3 @@ 'use strict'; | ||
if (error.stack) errorData.stack = resolveStackTraceString(error); | ||
console.error(errorData); | ||
console.error(JSON.stringify(errorData)); | ||
try { | ||
@@ -34,0 +34,0 @@ // Require on spot to avoid otherwise difficult to mitigate circular dependency |
@@ -7,8 +7,10 @@ 'use strict'; | ||
const type = options.type || 'INTERNAL'; | ||
console.warn({ | ||
source: 'serverlessSdk', | ||
type: `WARNING_TYPE_SDK_${type}`, | ||
message, | ||
code, | ||
}); | ||
console.warn( | ||
JSON.stringify({ | ||
source: 'serverlessSdk', | ||
type: `WARNING_TYPE_SDK_${type}`, | ||
message, | ||
code, | ||
}) | ||
); | ||
createWarningCapturedEvent(message, { | ||
@@ -15,0 +17,0 @@ _origin: 'nodeConsole', |
{ | ||
"name": "@serverless/sdk", | ||
"repository": "serverless/console", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"author": "Serverless, Inc.", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
72684
1419