From: Perttu Ahola Date: Sun, 20 May 2012 15:30:30 +0000 (+0300) Subject: Add better trace peudo-loglevel support X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=1f670fc68844d0a8503d8da04f59c8b662614907;p=zefram%2Fminetest%2Fminetest_engine.git Add better trace peudo-loglevel support --- diff --git a/src/log.cpp b/src/log.cpp index 57983109..a963f4c2 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -159,4 +159,5 @@ std::ostream actionstream(&actionbuf); std::ostream infostream(&infobuf); std::ostream verbosestream(&verbosebuf); +bool log_trace_level_enabled = false; diff --git a/src/log.h b/src/log.h index afbce57e..46af3f33 100644 --- a/src/log.h +++ b/src/log.h @@ -69,5 +69,10 @@ extern std::ostream actionstream; extern std::ostream infostream; extern std::ostream verbosestream; +extern bool log_trace_level_enabled; + +#define TRACESTREAM(x){ if(log_trace_level_enabled) verbosestream x; } +#define TRACEDO(x){ if(log_trace_level_enabled){ x ;} } + #endif diff --git a/src/main.cpp b/src/main.cpp index a990032d..b133722c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -854,8 +854,9 @@ int main(int argc, char *argv[]) // If trace is enabled, enable logging of certain things if(cmd_args.getFlag("trace")){ dstream<<"Enabling trace level debug output"<