diff options
Diffstat (limited to 'log.cpp')
-rw-r--r-- | log.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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; |