Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Community Connector Logger.log doesn't parse severity field provided in jsonPayload

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. enter image description here

enter image description here

enter image description here

like image 360
Víctor Campuzano Avatar asked Sep 07 '25 22:09

Víctor Campuzano


1 Answers

Logger actually has more methods available: 'warning', 'config', 'severe', 'info', 'fine', 'finer', 'finest'

They are still undocumented, but work just fine.

like image 117
Komlan Akpédjé KEDJI Avatar answered Sep 10 '25 10:09

Komlan Akpédjé KEDJI