-
In version 4.27.9, the first iteration of integrated winston-js logging was released. This new logging allows you to send logs to The logger, which can be imported as The redaction is useful to prevent Truncating is useful to prevent log files, and external logging services, from being filled with DataURLs/DataURIs, base64 strings or long message strings. Long strings in logs can result in memory leaks in some services. How toIn the below examples, we are going to set up the logs to:
In code:
...
create({
...
"logging": [
{
//Log to a rotating file,
"type": "file"
},
{
//Print logs to the console
"type": "console"
},
{
//Send logs to papertrail.
//You can get these details after signing up to papertrail
"type": "syslog"
"options": {
"host": "logs2.papertrailapp.com",
"port": 12345,
"protocol": "tls4",
"eol": "\n"
}
}
]
}) That's it. With that config you can now have three destinations for your logs. You may find that your preferred logging service does not have a Syslog configuration. For these cases you can just add your desired transport manually. In the example below, you can add Google Cloud Platform Stackdriver as a transport: //grab the main logger from open-wa
import { log, create } from '@open-wa/wa-automate'
//set up the gcp Transport
import { LoggingWinston } from '@google-cloud/logging-winston';
const gcpTransport = new LoggingWinston({
projectId: 'your-project-id',
keyFilename: '/path/to/keyfile.json'
});
...
//add the transport to the logger
log.add(
gcpTransport
)
...
//now you can start your session
create() EASY API/CLI (
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Answered above. Please leave feedback on instructions below. Thanks |
Beta Was this translation helpful? Give feedback.
Answered above.
Please leave feedback on instructions below.
Thanks