You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`dev`| Boolean | Enable development mode which pretty-prints JSON to the console. |`false`|
124
-
|`silent`| Boolean | Disables logging to `console` but messages and events are still generated. |`false`|
125
-
|`replacer`| Function | Replacer function for `JSON.stringify()` to allow handling of sensitive data before logs are written. See [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter). |`null`|
126
-
|`stdoutStream`| Stream | Stream in which non-error logs will be written to. This option cannot be changed after instantiation. See [Log Streams](#log-streams). |`process.stdout`|
127
-
|`stderrStream`| Stream | Stream in which error logs will be written to. This option cannot be changed after instantiation. See [Log Streams](#log-streams). |`process.stderr`|
|`dev`| Boolean | Enable development mode which pretty-prints JSON to the console. |`false`|
125
+
|`silent`| Boolean | Disables logging to `console` but messages and events are still generated. |`false`|
126
+
|`replacer`| Function | Replacer function for `JSON.stringify()` to allow handling of sensitive data before logs are written. See [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter). |`null`|
127
+
|`logHandler`| Object | A `console`-like object containing all standard console functions. Allows logs to be written to any custom location. See [Log Handler](#loghandler). |`console`|
New in version 2.0.0, you may now customize the streams in which logs are written to. By default, all logs are written using the built-in `console` object to `process.stdout` and `process.stderr`. You may use alternative streams (like `fs.createWriteStream()` to log to a file) to customize where your logs go. This is useful for non-aws or custom implementations so logs may be sent to the most convient place.
401
+
### Log Handler
402
+
New in version 2.1.0, you may now customize the methods used to log messages. By default, lambda-log uses the global `console` object, but you can override this with a custom instance of <code><ahref="https://nodejs.org/docs/latest-v8.x/api/console.html#console_new_console_stdout_stderr">Console</a></code> or your own `console`-like object that implements, at minimum, the following functions:
403
+
404
+
* log
405
+
* debug
406
+
* info
407
+
* error
408
+
* warn
409
+
410
+
Keep in mind that custom implementations must be synchronus. If you need it to be asynchronus, you will need to use a custom <code><ahref="https://nodejs.org/docs/latest-v8.x/api/console.html#console_new_console_stdout_stderr">Console</a></code> instance and implement utilizing streams.
0 commit comments