@middy/error-logger
Advanced tools
Comparing version 5.0.0-alpha.1 to 5.0.0-alpha.2
30
index.js
const defaults = { | ||
logger: ({ error }) => console.error(error) | ||
} | ||
logger: ({ error })=>console.error(error) | ||
}; | ||
const errorLoggerMiddleware = (opts = {})=>{ | ||
let { logger } = { | ||
...defaults, | ||
...opts | ||
}; | ||
if (typeof logger !== 'function') logger = null; | ||
const errorLoggerMiddlewareOnError = async (request)=>{ | ||
logger(request); | ||
}; | ||
return { | ||
onError: logger ? errorLoggerMiddlewareOnError : null | ||
}; | ||
}; | ||
export default errorLoggerMiddleware; | ||
const errorLoggerMiddleware = (opts = {}) => { | ||
let { logger } = { ...defaults, ...opts } | ||
if (typeof logger !== 'function') logger = null | ||
const errorLoggerMiddlewareOnError = async (request) => { | ||
logger(request) | ||
} | ||
return { | ||
onError: logger ? errorLoggerMiddlewareOnError : null | ||
} | ||
} | ||
export default errorLoggerMiddleware |
{ | ||
"name": "@middy/error-logger", | ||
"version": "5.0.0-alpha.1", | ||
"version": "5.0.0-alpha.2", | ||
"description": "Input and output logger middleware for the middy framework", | ||
@@ -63,3 +63,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@middy/core": "5.0.0-alpha.1", | ||
"@middy/core": "5.0.0-alpha.2", | ||
"@types/node": "^20.0.0" | ||
@@ -66,0 +66,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6184
23