I'm trying to log JSON Objects from my Google Apps Script - Data Studio Community Connector code to Stackdriver Logging as described in the official doc
Using console.log(jsonObject)
the jsonObject is converted to string. It doesn't work.
Using Logger.log(jsonObject)
instead, the jsonObject y parsed inside de jsonPayload property of the log entry. Good.
But all log entries are inserted with INFO severity level.
If I include the severity property inside de jsonObject, the severity is not parsed as expected.
I tried a few options including the severity as string "ERROR" or a number 500 but it doesn't work.
Some examples I tried from my Community Connector Code:
Logger.log({
message: 'This is the message / title for the log entry. Works fine',
severity: 'ERROR',
otherData: {
userId: '459',
connectorType: 'blahblah',
includeFilters: true
}
});
OR
Logger.log({
message: 'This is the message / title for the log entry. Works fine',
severity: 500,
otherData: {
userId: '459',
connectorType: 'blahblah',
includeFilters: true
}
});
As you can see, the severity property never gets parsed as the severity level.
Logger
actually has more methods available: 'warning', 'config', 'severe', 'info', 'fine', 'finer', 'finest'
They are still undocumented, but work just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With