summaryrefslogtreecommitdiff
path: root/src/log.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-27 13:52:10 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:55 +0200
commit6e0de7b42cce06aff5ae18664b61d6a1c3484f5e (patch)
tree362de3d9a965153c586db3eada7a0b4b2d5a4c5d /src/log.cpp
parent2e42391b869f8e0290ac9f5c94b9529c5e410d02 (diff)
downloadminetest-6e0de7b42cce06aff5ae18664b61d6a1c3484f5e.tar.gz
minetest-6e0de7b42cce06aff5ae18664b61d6a1c3484f5e.tar.bz2
minetest-6e0de7b42cce06aff5ae18664b61d6a1c3484f5e.zip
Add log_remove_output and log_deregister_thread
Diffstat (limited to 'src/log.cpp')
-rw-r--r--src/log.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/log.cpp b/src/log.cpp
index cc981dadd..188b9b679 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <map>
#include <list>
#include <sstream>
+#include <algorithm>
#include "threads.h"
#include "debug.h"
#include "gettime.h"
@@ -46,12 +47,28 @@ void log_add_output_all_levs(ILogOutput *out)
log_outputs[i].push_back(out);
}
+void log_remove_output(ILogOutput *out)
+{
+ for(int i=0; i<LMT_NUM_VALUES; i++){
+ std::list<ILogOutput*>::iterator it =
+ std::find(log_outputs[i].begin(), log_outputs[i].end(), out);
+ if(it != log_outputs[i].end())
+ log_outputs[i].erase(it);
+ }
+}
+
void log_register_thread(const std::string &name)
{
threadid_t id = get_current_thread_id();
log_threadnames[id] = name;
}
+void log_deregister_thread()
+{
+ threadid_t id = get_current_thread_id();
+ log_threadnames.erase(id);
+}
+
static std::string get_lev_string(enum LogMessageLevel lev)
{
switch(lev){