trace

Debugging aid: Output variable name/value and file/line info to stderr.

Also flushes stderr to ensure buffering and a subsequent crash don't cause the message to get lost.

template trace(alias var)
void
trace
(
string file = __FILE__
size_t line = __LINE__
)
(
)

Examples

1 auto x = 5;
2 auto str = "Hello";
3 
4 // Output example:
5 // src/myproj/myfile.d(42): x: 5
6 // src/myproj/myfile.d(43): str: Hello
7 trace!x;
8 trace!str;

Meta