How to write json to Google Cloud Driver

Viewed 127

I am using django for logging. Here is what I have so far:

from google.cloud import logging
client = logging.Client.from_service_account_json('file.json')
client.setup_logging()

LOGGING = {

 'version': 1,


 'handlers': {

    'stackdriver': {
        'level': 'INFO',
        'class': 'google.cloud.logging.handlers.CloudLoggingHandler',
        'client': client,
    },
  },

 'loggers': {
    'app': {
        'handlers': ['stackdriver'],
        'level': 'INFO',
        'propagate': False,
    },
  }

}

And here is how it shows up in Google Stackdriver:

enter image description here

Is there a way to actually add additional key/value fields instead of just having the json message be formatted as text? Can any fields be added except for the "message". How would this be done?

1 Answers
Related