2020-04-16 16:27:56 +02:00
|
|
|
module utils.debugging;
|
|
|
|
|
|
|
|
import std.stdio : writeln;
|
2020-04-30 19:10:26 +02:00
|
|
|
import std.process : environment;
|
2020-04-30 19:43:20 +02:00
|
|
|
import std.conv : to;
|
2020-04-16 16:27:56 +02:00
|
|
|
|
2020-04-28 18:03:48 +02:00
|
|
|
alias dprint = debugPrint;
|
|
|
|
|
2020-04-30 19:43:20 +02:00
|
|
|
void debugPrint(MessageType)(MessageType message)
|
2020-04-16 16:27:56 +02:00
|
|
|
{
|
2020-04-30 19:10:26 +02:00
|
|
|
/* Check if the environment variable for `B_DEBUG` exists */
|
|
|
|
if(!(environment.get("B_DEBUG") is null))
|
|
|
|
{
|
2020-04-30 19:43:20 +02:00
|
|
|
writeln("[DEBUG] " ~ to!(string)(message));
|
2020-04-30 19:10:26 +02:00
|
|
|
}
|
2020-04-16 16:27:56 +02:00
|
|
|
}
|