log()

Output a message in the query response and return null.

Signature

log()(message: Any) => Null

Description

The log() method outputs message to the query response in the summary field.

The message template is:

info at *<source>*:<line>: <message>

where:

Field Description

<source>

Message source.
One of:

Source Description

query

The log() call occurred in the main query body.

udf:<function>

The log() call occurred in the user-defined function named <function>

<line>

Line number where log() is used.

<message>

String-serialized message.

Parameters

Parameter Type Required Description

message

Any

Yes

Value to output to the query response.

Return value

Type Description

Null

After output, the message is discarded.

Examples

Include messages and variable values in the query response:

log("Before assignment")
let x = 5
let y = { lat: 37.5542782, long: -122.3007394 }
log("After assignment x=#{x}")
log(y)
x
info at *query*:1: Before assignment

info at *query*:4: After assignment x=5

info at *query*:5: { lat: 37.5542782, long: -122.3007394 }

5

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!