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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Microsof...', 1758209577, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Microsoft/Power-Query/M-formula/standard-library/Diagnostics/Trace/index(57): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78