FuncDebug

Function debugging mixin with the given function and the writer to use

Members

Mixins

__anonymous
mixin FuncDebugBase!(func, writer)
Undocumented in source.

Mixed In Members

From mixin FuncDebugBase!(func, writer)

enter
void enter(bool showArguments)

Enter a function

args
void args(string spc)

Prints the formal parameter names and their respective argument values

say
void say(string message)

Prints a message from within the function

leave
void leave()

Leaves a function

Parameters

func

the function's symbol

writer

the string-callable delegate to use for writing (by default this is a proxy to writeln(string)) the messages to

Examples

Example usage of the FuncDebug mixin template using a custom writer delegate

string[] written;
void testWriter(string s)
{
    written ~= s;
}

void myFunc(int x, int y)
{
    mixin FuncDebug!(myFunc, &testWriter);
    enter(true);

    say("Good day governor");

    leave();
}

myFunc(69, 420);

assert(written[0] == format("%s(): Enter", "myFunc"));
assert(written[1] == "\tx = 69");
assert(written[2] == "\ty = 420");
assert(written[3] == format("%s(): %s", "myFunc", "Good day governor"));
assert(written[4] == format("%s(): Leave", "myFunc"));

Meta