diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2013-01-12 06:34:11 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2013-01-12 06:34:11 +0000 |
commit | e7c4081ac0449d998b274d46e6869f69abdecf36 (patch) | |
tree | d14d616c2648324439a09e0b098cdefc33dd52b5 /plugins/New_GPG/src/log.cpp | |
parent | 347b22f4feab779fe808f3dcfd93206a85e497ed (diff) |
additional private keys checks
additional debug and error messages
improoved debug logging
removed metacontcats encodings problem workaround
git-svn-id: http://svn.miranda-ng.org/main/trunk@3062 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src/log.cpp')
-rwxr-xr-x | plugins/New_GPG/src/log.cpp | 78 |
1 files changed, 35 insertions, 43 deletions
diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp index 273d37060d..29f80a1d5e 100755 --- a/plugins/New_GPG/src/log.cpp +++ b/plugins/New_GPG/src/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()
{
|