...
Code Block | ||||
---|---|---|---|---|
| ||||
// In case of error, in the below code we are also sending metadata such as filepath and err in final log message. log.error(context, {filepath: __filename, err: err}); // In case you want to send debug message log.debug(context, 'This is my debug message'); |
Parameters
- There are three parameters: context, payload and When using custom logger in action code, context, must be the first parameter and then you can add your own (optional) message. context and payload parameters are used to Your message can be an object or a string.
- context is used to provide access to request id and navigation stack. message parameter Also to know the user who has sent the request.
- Your own message can take a string or a JavaScript object. Treat this as metadata that you want to send in your log message. You can send whatever you want.
...