Day #15 with Cloud Workflows: built-in cloud logging function
In the two previous episodes, we saw how to create and call subworkflows , and we applied this technique to making a reusable routine for logging with Cloud Logging. However, there’s already a built-in function for that purpose! So let’s have a look at this integration.
To call the built-in logging function, just create a new step, and make a call to the sys.log function:
text: Hello Cloud Logging!
This function takes a mandatory parameter: text . And an optional one: severity .
The text parameter accepts all types of supported values, so it’s not only string, but all kinds of numbers, as well as arrays and dictionaries. Their string representation will be used as text.
The optional severity parameter is an enum that can take the values: DEFAULT , DEBUG , INFO , NOTICE , WARNING , ERROR , CRITICAL , ALERT , EMERGENCY , with DEFAULT being… the default value if you don’t specify a severity!
Here’s another example with a dictionary as parameter, which will be output as text in the logs, and a severity of WARNING :
Looking at the results in the cloud logging console, you will see both messages appear:
Don’t hesitate to have a look at reference documentation to find more about the available built-in functions.
Originally published at http://glaforge.appspot.com.