X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flog.h;h=bd223927a6c18158427ede259a9799424e9030c0;hb=cf77e0333d1ba0aa81fdce80cd0fa32f137b0a47;hp=46af3f33f943035429061156f2406211c6e414cd;hpb=1f670fc68844d0a8503d8da04f59c8b662614907;p=minetest.git diff --git a/src/log.h b/src/log.h index 46af3f33f..bd223927a 100644 --- a/src/log.h +++ b/src/log.h @@ -1,18 +1,18 @@ /* -Minetest-c55 -Copyright (C) 2011 celeron55, Perttu Ahola +Minetest +Copyright (C) 2013 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +GNU Lesser General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ @@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., /* Use this for logging everything. - + If you need to explicitly print something, use dstream or cout or cerr. */ @@ -39,18 +39,25 @@ enum LogMessageLevel { class ILogOutput { public: + ILogOutput() : + silence(false) + {} + /* line: Full line with timestamp, level and thread */ virtual void printLog(const std::string &line){}; /* line: Full line with timestamp, level and thread */ virtual void printLog(const std::string &line, enum LogMessageLevel lev){}; /* line: Only actual printed text */ virtual void printLog(enum LogMessageLevel lev, const std::string &line){}; + + bool silence; }; void log_add_output(ILogOutput *out, enum LogMessageLevel lev); void log_add_output_maxlev(ILogOutput *out, enum LogMessageLevel lev); void log_add_output_all_levs(ILogOutput *out); void log_remove_output(ILogOutput *out); +void log_set_lev_silence(enum LogMessageLevel lev, bool silence); void log_register_thread(const std::string &name); void log_deregister_thread(); @@ -74,5 +81,22 @@ 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 ;} } +extern std::ostream *dout_con_ptr; +extern std::ostream *derr_con_ptr; +extern std::ostream *dout_server_ptr; +extern std::ostream *derr_server_ptr; +#define dout_con (*dout_con_ptr) +#define derr_con (*derr_con_ptr) +#define dout_server (*dout_server_ptr) +#define derr_server (*derr_server_ptr) + +#ifndef SERVER +extern std::ostream *dout_client_ptr; +extern std::ostream *derr_client_ptr; +#define dout_client (*dout_client_ptr) +#define derr_client (*derr_client_ptr) + +#endif + #endif