18.4.0 released Sep 25, 2023
Trace run

Purpose: Emit trace.

trace-run [ <format>, <expression> [ , ... ] ]

trace-run formats a tracing message according to the <format> string and a list of variable-type <expression>s (in the same way C's printf() does) and then writes the result into current process' trace_file (if enabled, see vv) without any encoding (meaning a string is output exactly as it is).

trace-run can be used without any clauses, in which case a location (file name and line number) is recorded in the trace file - this is useful when you only want to know if the execution passed through code.

If trace-run has any other clauses, then <format> string must be present and there must be at least one <expression> (it means if you want to trace a simple string literal you still have to use "%s" as format).

For tracing to have effect, debugging and tracing must be enabled (see vv). For location of trace files, see how-vely-works.
// Trace information
trace-run "Program wrote %lld bytes into file %s", num_bytes, file_name

// Trace that program execution passed through here

See example-hello-world for an example in debugging and tracing.
See also
See all

You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a link back to this page (dofollow) - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind.