The options for the transport. Generally only required for syslog but you can use this to override default options for other types of transports.
The type of winston transport. At the moment only file
, console
, ev
and syslog
are supported.
You can access the log in your code and add your own custom transports https://github.com/winstonjs/winston#transports see Logger for more details.
Here is an example of adding the GCP stackdriver transport:
import { log } from '@open-wa/wa-automate'
import { LoggingWinston } from '@google-cloud/logging-winston';
const gcpTransport = new LoggingWinston({
projectId: 'your-project-id',
keyFilename: '/path/to/keyfile.json'
});
...
log.add(
gcpTransport
)
//Congrats! Now all of your session logs will also go to GCP Stackdriver
If the transport has already been added to the logger. The logging set up command handles this for you.