aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-05-20 18:30:30 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-05-20 18:30:30 +0300
commit1f670fc68844d0a8503d8da04f59c8b662614907 (patch)
tree32d8727ffe7789391c0606ca71e0125f17deeb88
parent388906ac70ff13c4a2b88833872b9123034f5d1a (diff)
downloadminetest-1f670fc68844d0a8503d8da04f59c8b662614907.tar.gz
minetest-1f670fc68844d0a8503d8da04f59c8b662614907.tar.bz2
minetest-1f670fc68844d0a8503d8da04f59c8b662614907.zip
Add better trace peudo-loglevel support
-rw-r--r--src/log.cpp1
-rw-r--r--src/log.h5
-rw-r--r--src/main.cpp5
3 files changed, 9 insertions, 2 deletions
diff --git a/src/log.cpp b/src/log.cpp
index 579831096..a963f4c27 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 afbce57e9..46af3f33f 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 a990032df..b133722c3 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"<<std::endl;
- dout_con_ptr = &verbosestream;
- socket_enable_debug_output = true;
+ log_trace_level_enabled = true;
+ dout_con_ptr = &verbosestream; // this is somewhat old crap
+ socket_enable_debug_output = true; // socket doesn't use log.h
}
// In certain cases, output info level on stderr
if(cmd_args.getFlag("info") || cmd_args.getFlag("verbose") ||