@middy/input-output-logger 4.0.0 → 4.0.1

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.
Files changed (2) hide show
  1. package/README.md +0 -72
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -36,78 +36,6 @@
36
36
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/input-output-logger">https://middy.js.org/docs/middlewares/input-output-logger</a></p>
37
37
  </div>
38
38
 
39
- Logs the incoming request (input) and the response (output).
40
-
41
- By default, the logging operate by using the `console.log` function. You can pass as a parameter a custom logger with additional logic if you need. It can be useful if you want to process the log by doing a http call or anything else.
42
-
43
-
44
- ## Install
45
-
46
- To install this middleware you can use NPM:
47
-
48
- ```bash
49
- npm install --save @middy/input-output-logger
50
- ```
51
-
52
-
53
- ## Options
54
-
55
- - `logger` (function) (default `console.log`): logging function that accepts an object
56
- - `awsContext` (boolean) (default `false`): Include [AWS Lambda context object](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html) to the logger
57
- - `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 []).
58
- - `mask` (string) (default `undefined`): When set to a truthy value (i.e. `*** redacted ***`) a path is replaced instead of omitted.
59
- - `replacer` (function) (default `undefined`): A [replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Parameters) parameter may be passed which will be used `JSON.stringify`ing the request during cloning.
60
-
61
- ## Sample usage
62
-
63
- ```javascript
64
- import middy from '@middy/core'
65
- import inputOutputLogger from '@middy/input-output-logger'
66
-
67
- const handler = middy((event, context) => {
68
- const response = {
69
- statusCode: 200,
70
- headers: {},
71
- body: JSON.stringify({ message: 'hello world' })
72
- };
73
- return response
74
- })
75
-
76
- handler
77
- .use(inputOutputLogger())
78
- ```
79
-
80
- ```javascript
81
- import middy from '@middy/core'
82
- import inputOutputLogger from '@middy/input-output-logger'
83
- import pino from 'pino'
84
- const logger = pino()
85
-
86
- const handler = middy((event, context) => {
87
- // ...
88
- return response
89
- })
90
-
91
- handler
92
- .use(inputOutputLogger({
93
- logger: (request) => {
94
- const child = logger.child(request.context)
95
- child.info(request.event ?? request.response)
96
- },
97
- awsContext: true
98
- }))
99
- ```
100
-
101
- ## Middy documentation and examples
102
-
103
- For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
104
-
105
-
106
- ## Contributing
107
-
108
- Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
109
-
110
-
111
39
  ## License
112
40
 
113
41
  Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/input-output-logger",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Input and output logger middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -62,11 +62,11 @@
62
62
  },
63
63
  "homepage": "https://middy.js.org",
64
64
  "dependencies": {
65
- "@middy/util": "4.0.0"
65
+ "@middy/util": "4.0.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@middy/core": "4.0.0",
68
+ "@middy/core": "4.0.1",
69
69
  "@types/node": "^18.0.0"
70
70
  },
71
- "gitHead": "582286144bcd79968a8c7c2f8867a23c80079a47"
71
+ "gitHead": "c5ece2bfbb0d607dcdea5685bf194a6cc19acc8d"
72
72
  }