Nav

log

log(String, T): T

Logs the specified value with a given prefix. Then it returns the value unchanged.

Transform

        
     
1
2
3
4
%dw 2.0
payload application/json
---
{ age: log("My Age", payload.age) }
Input:

        
     
1
{ "age" : 33 }

This will print this output: My Age - 33.

Output

        
     
1
<age>33</age>

Note that besides producing the expected output, it also logs it.