Closed
Description
std.trace(str, rest)
outputs the given string str
to stderr and returns rest
as the result.
Example:
local conditionalReturn(cond, in1, in2) =
if (cond) then
std.trace('cond is true returning '
+ std.toString(in1), in1)
else
std.trace('cond is false returning '
+ std.toString(in2), in2);
{
a: conditionalReturn(true, { b: true }, { c: false }),
}
Prints:
TRACE: test.jsonnet:3 cond is true returning {"b": true}
{
"a": {
"b": true
}
}