Writes one of data
, text
, or json
to the log at specified severity.
The log is written using the Cloud Logging API, the
workflows.googleapis.com/Workflow
resource, and under the log name
projects/${GOOGLE_CLOUD_PROJECT_ID}/logs/Workflows
.
For more information, see Send logs to Cloud Logging.
Arguments
Arguments | |
---|---|
data |
The log message. Maps are logged as a JSON payload and stored in the
|
severity |
One of:
|
text |
The log message. Always logged as a text payload and stored in the
|
json |
The map to be logged as a JSON payload and stored in the
|
timeout |
The timeout of the log call.
|
Raised exceptions
Exceptions | |
---|---|
TypeError |
|
TimeoutError |
If the specified timeout is exceeded. |
Examples
Auto-detect payload type
- assignStep:
assign:
- myVar: "Log my error message"
- argsMap:
call: sys.log
args:
data: ${myVar}
severity: "ERROR" # Optional
- argsList:
call: sys.log
args: [${myVar}, "ERROR"]
Sample output
{
"textPayload": "Log my error message",
...
"severity": "ERROR",
...
}
Log as text
- assignStep:
assign:
- myVar: "Log my error message"
- argsMap:
call: sys.log
args:
text: ${myVar}
severity: "ERROR" # Optional
- argsList:
call: sys.log
args: [${null}, "ERROR", ${myVar}]
Sample output
{
"textPayload": "Log my error message",
...
"severity": "ERROR",
...
}
Log as JSON
- createMap:
assign:
- myMap: {"Message1": "Log my error message"}
- argsMap:
call: sys.log
args:
json: ${myMap}
severity: "ERROR" # Optional
- argsList:
call: sys.log
args: [${null}, "ERROR", ${null}, ${myMap}]
Sample output
{
...
"jsonPayload": {
"Message1": "Log my error message"
},
...
"severity": "ERROR",
...
}