So I am doing some simple logging to GCP stackdriver using v1 of the python google cloud logging library (see below). I'm not clear on how to set the "severity" level for the log entry. The severity currently shows up in Stackdriver as "default" when I log as below. How do I set the severity? It isn't clear to me from the documentation.
import google.cloud.logging as glog1
def do_v1_log():
# Instantiates a client
logging_client = glog1.Client()
# The name of the log to write to
log_name = 'gregs-log'
# Selects the log to write to
logger = logging_client.logger(log_name)
# Writes the log entry
logger.log_struct({'name': 'Greg', 'phone': '619-555-1809'})
# Main bootstrapping routine
if __name__ == "__main__":
# main()
do_v1_log()
You can set the severity in the log entry :
LogEntry
Python Client for Stackdriver Logging¶
Another example of Writing log entries