summaryrefslogtreecommitdiff
path: root/log.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-01-12 09:49:04 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-01-12 09:49:04 +0200
commitd884a2fd95cd535aef2640e6a592762b3c484ed2 (patch)
tree557a20f1199db108dc596bc97d5b31eb0e18472f /log.cpp
parent4a8d2270c087aef94fbd0b7d19df6dec05441edf (diff)
merged with miranda_ng main repo
Diffstat (limited to 'log.cpp')
-rwxr-xr-xlog.cpp78
1 files changed, 35 insertions, 43 deletions
diff --git a/log.cpp b/log.cpp
index 273d370..29f80a1 100755
--- a/log.cpp
+++ b/log.cpp
@@ -19,71 +19,63 @@
logtofile& logtofile::operator<<(TCHAR *buf)
{
- extern bool bDebugLog;
- if(bDebugLog)
- {
- log_mutex.lock();
- log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
- log<<toUTF8(buf);
- log<<"\n";
- log.close();
- log_mutex.unlock();
- }
+ if(_bDebugLog != bDebugLog)
+ init();
+ log_mutex.lock();
+ log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
+ log<<toUTF8(buf);
+ log<<"\n";
+ log.close();
+ log_mutex.unlock();
return *this;
}
logtofile& logtofile::operator<<(char *buf)
{
- extern bool bDebugLog;
- if(bDebugLog)
- {
- log_mutex.lock();
- log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
- log<<buf;
- log<<"\n";
- log.close();
- log_mutex.unlock();
- }
+ if(_bDebugLog != bDebugLog)
+ init();
+ log_mutex.lock();
+ log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
+ log<<buf;
+ log<<"\n";
+ log.close();
+ log_mutex.unlock();
return *this;
}
logtofile& logtofile::operator<<(string buf)
{
- extern bool bDebugLog;
- if(bDebugLog)
- {
- log_mutex.lock();
- char *tmp = mir_utf8encode(buf.c_str());
- log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
- log<<tmp;
- log<<"\n";
- log.close();
- log_mutex.unlock();
- mir_free(tmp);
- }
+ if(_bDebugLog != bDebugLog)
+ init();
+ log_mutex.lock();
+ char *tmp = mir_utf8encode(buf.c_str());
+ log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
+ log<<tmp;
+ log<<"\n";
+ log.close();
+ log_mutex.unlock();
+ mir_free(tmp);
return *this;
}
logtofile& logtofile::operator<<(wstring buf)
{
- extern bool bDebugLog;
- if(bDebugLog)
- {
- log_mutex.lock();
- log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
- log<<toUTF8(buf);
- log<<"\n";
- log.close();
- log_mutex.unlock();
- }
+ if(_bDebugLog != bDebugLog)
+ init();
+ log_mutex.lock();
+ log.open(toUTF8(path).c_str(), std::ios::app |std::ios::ate);
+ log<<toUTF8(buf);
+ log<<"\n";
+ log.close();
+ log_mutex.unlock();
return *this;
}
void logtofile::init()
{
- extern bool bDebugLog;
if(bDebugLog)
{
if(path)
mir_free(path);
path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szLogFilePath", _T("C:\\GPGdebug.log"));
}
+ _bDebugLog = bDebugLog;
}
logtofile::logtofile()
{