From: Perttu Ahola Date: Thu, 22 Mar 2012 12:10:24 +0000 (+0200) Subject: Add output levels --info and --trace (--verbose is now more verbose) X-Git-Tag: 0.4.dev-20120326~51 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c13691a8e6febee561c839ded33b0f33c53b12d3;p=oweals%2Fminetest.git Add output levels --info and --trace (--verbose is now more verbose) --- diff --git a/doc/minetest.6 b/doc/minetest.6 index 2a39b870d..0d6433f29 100644 --- a/doc/minetest.6 +++ b/doc/minetest.6 @@ -61,9 +61,15 @@ Run dedicated server \-\-speedtests Run speed tests .TP -\-\-verbose +\-\-info Print more information to console .TP +\-\-verbose +Print even more information to console +.TP +\-\-trace +Print enormous amounts of information to console +.TP \-\-world Set world path diff --git a/doc/minetestserver.6 b/doc/minetestserver.6 index dffe0fc8e..81203954d 100644 --- a/doc/minetestserver.6 +++ b/doc/minetestserver.6 @@ -40,9 +40,15 @@ Same as --world (deprecated) \-\-port Set network port (UDP) to use .TP -\-\-verbose +\-\-info Print more information to console .TP +\-\-verbose +Print even more information to console +.TP +\-\-trace +Print enormous amounts of information to console +.TP \-\-world Set world path diff --git a/src/main.cpp b/src/main.cpp index 75ff569aa..fe1bcd450 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -90,8 +90,6 @@ Profiler *g_profiler = &main_profiler; // Connection std::ostream *dout_con_ptr = &dummyout; std::ostream *derr_con_ptr = &verbosestream; -//std::ostream *dout_con_ptr = &infostream; -//std::ostream *derr_con_ptr = &errorstream; // Server std::ostream *dout_server_ptr = &infostream; @@ -779,8 +777,12 @@ int main(int argc, char *argv[]) "Same as --world (deprecated)")); allowed_options.insert("world", ValueSpec(VALUETYPE_STRING, "Set world path (implies local game)")); - allowed_options.insert("verbose", ValueSpec(VALUETYPE_FLAG, + allowed_options.insert("info", ValueSpec(VALUETYPE_FLAG, "Print more information to console")); + allowed_options.insert("verbose", ValueSpec(VALUETYPE_FLAG, + "Print even more information to console")); + allowed_options.insert("trace", ValueSpec(VALUETYPE_FLAG, + "Print enormous amounts of information to log and console")); allowed_options.insert("logfile", ValueSpec(VALUETYPE_STRING, "Set logfile path ('' = no logging)")); allowed_options.insert("gameid", ValueSpec(VALUETYPE_STRING, @@ -833,9 +835,19 @@ int main(int argc, char *argv[]) Low-level initialization */ + // If trace is enabled, enable logging of certain things + if(cmd_args.getFlag("trace")){ + dstream<<"Enabling trace level debug output"< #include "utility.h" -// Debug printing options -// Set to 1 for debug output -#define DP 0 +bool socket_enable_debug_output = false; +#define DP socket_enable_debug_output // This is prepended to everything printed here #define DPS "" diff --git a/src/socket.h b/src/socket.h index fe542dfcc..ac26b575c 100644 --- a/src/socket.h +++ b/src/socket.h @@ -23,6 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "exceptions.h" +extern bool socket_enable_debug_output; + class SocketException : public BaseException { public: