Skip to content

Commit

Permalink
fix: remove unused option
Browse files Browse the repository at this point in the history
  • Loading branch information
willfarrell committed May 8, 2024

Verified

This commit was signed with the committer’s verified signature.
willfarrell will Farrell
1 parent e08344a commit 793391d
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/input-output-logger/index.d.ts
Original file line number Diff line number Diff line change
@@ -5,9 +5,8 @@ interface Options {
awsContext?: boolean
omitPaths?: string[]
mask?: string
replacer?: (this: any, key: string, value: any) => any | Array<number | string>
}

declare function inputOutputLogger (options?: Options): middy.MiddlewareObj
declare function inputOutputLogger(options?: Options): middy.MiddlewareObj

export default inputOutputLogger
7 changes: 3 additions & 4 deletions packages/input-output-logger/index.js
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ const defaults = {
logger: console.log,
awsContext: false,
omitPaths: [],
mask: undefined,
replacer: undefined
mask: undefined
}

const inputOutputLoggerMiddleware = (opts = {}) => {
const { logger, awsContext, omitPaths, mask, replacer } = {
const { logger, awsContext, omitPaths, mask } = {
...defaults,
...opts
}
@@ -33,7 +32,7 @@ const inputOutputLoggerMiddleware = (opts = {}) => {

let cloneMessage = message
if (omitPaths.length) {
cloneMessage = structuredClone(message, replacer) // Full clone to prevent nested mutations
cloneMessage = structuredClone(message) // Full clone to prevent nested mutations
omit(cloneMessage, { [param]: omitPathTree[param] })
}
logger(cloneMessage)
1 change: 0 additions & 1 deletion website/docs/middlewares/input-output-logger.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ npm install --save @middy/input-output-logger
- `awsContext` boolean (default `false`): Include [AWS Lambda context object](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html) to the logger
- `omitPaths` string[] (default `[]`): property accepts an array of paths that will be used to remove particular fields import the logged objects. This could serve as a simple way to redact sensitive data from logs (default []). Examples: `name`, `user.name`, `users.[].name`
- `mask` string: String to replace omitted values with. Example: `***omitted***`
- `replacer` function: stringify `replacer` function

Note: If using with `{ streamifyResponse: true }`, your ReadableStream must be of type `string`.

0 comments on commit 793391d

Please sign in to comment.