Skip to content

Instantly share code, notes, and snippets.

@zaydek-old
Created July 31, 2017 22:03
Show Gist options
  • Save zaydek-old/f287e486288c97c0deda3df63aee09fd to your computer and use it in GitHub Desktop.
Save zaydek-old/f287e486288c97c0deda3df63aee09fd to your computer and use it in GitHub Desktop.
import std.array, std.stdio;
enum trace = q{version(verbose)
{
writefln("%s> %s", "-".replicate(++depth), split(__PRETTY_FUNCTION__, ".")[$ - 1]); scope(exit)
writefln("<%s %s", "-".replicate(depth--), split(__PRETTY_FUNCTION__, ".")[$ - 1]);
}};
ulong depth;
void main()
{
mixin(trace);
foo();
}
void foo()
{
mixin(trace);
bar();
}
void bar()
{
mixin(trace);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment