Search notes:

Power Query M formula language standard library: Diagnostics.Trace

Diagnostics.Trace allows to write directly, if tracing is enabled, to the Power BI trace log from a query.
Diagnostics.Trace(
            traceLevel as number,
            message    as anynonnull,
            value      as any,
   optional delayed    as nullable logical
)
as any
The following expression writes Hello world into the log and evaluates to 42.
Diagnostics.Trace(
   TraceLevel.Information, 
  "Hello world", 
   () => 42, 
   true
)

See also

Tracing can be enabled under File -> Options & Settings -> Query Options -> Global -> Diagnostics. This dialog has also the link «Open crash dump/trace folder» which opens to the location where the trace log is written to.
The Power Query standard library

Index