summaryrefslogtreecommitdiff
path: root/log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'log.cpp')
-rw-r--r--log.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/log.cpp b/log.cpp
index 187ce85..d4d65a7 100644
--- a/log.cpp
+++ b/log.cpp
@@ -21,10 +21,12 @@ logtofile& logtofile::operator<<(TCHAR *buf)
extern bool bDebugLog;
if(bDebugLog)
{
+ log_mutex.lock();
char *tmp = mir_utf8encodeW(buf);
log.open(path, std::ios::app |std::ios::ate);
log<<tmp;
log.close();
+ log_mutex.unlock();
mir_free(tmp);
}
return *this;
@@ -34,10 +36,12 @@ logtofile& logtofile::operator<<(char *buf)
extern bool bDebugLog;
if(bDebugLog)
{
+ log_mutex.lock();
char *tmp = mir_utf8encode(buf);
log.open(path, std::ios::app |std::ios::ate);
log<<tmp;
log.close();
+ log_mutex.unlock();
mir_free(tmp);
}
return *this;
@@ -47,10 +51,12 @@ logtofile& logtofile::operator<<(string buf)
extern bool bDebugLog;
if(bDebugLog)
{
+ log_mutex.lock();
char *tmp = mir_utf8encode(buf.c_str());
log.open(path, std::ios::app |std::ios::ate);
log<<tmp;
log.close();
+ log_mutex.unlock();
mir_free(tmp);
}
return *this;
@@ -60,10 +66,12 @@ logtofile& logtofile::operator<<(wstring buf)
extern bool bDebugLog;
if(bDebugLog)
{
+ log_mutex.lock();
char *tmp = mir_utf8encodeW(buf.c_str());
log.open(path, std::ios::app |std::ios::ate);
log<<tmp;
log.close();
+ log_mutex.unlock();
mir_free(tmp);
}
return *this;