diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index 1d9e7bbe..c2c66a9e 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -722,7 +722,7 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT { const std::wstring& strStyleValue = GetValue((*iter), strKey, strDefault); - //CLogger_DebugF(L"StyleTemplate: [%s] %s (from [%s]) : strDefault=%s (0x%p), strStyleValue=%s (0x%p)", + //LogDebugF(L"StyleTemplate: [%s] %s (from [%s]) : strDefault=%s (0x%p), strStyleValue=%s (0x%p)", // section, key, (*iter).c_str(), strDefault.c_str(), &strDefault, strStyleValue.c_str(), &strStyleValue); if (&strStyleValue != &strDefault) @@ -850,7 +850,7 @@ int CConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue) return (int)dblValue; } - CLogger_ErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); + LogErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); } else if (*string) { @@ -882,7 +882,7 @@ uint32_t CConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, uint32_t defValue return (uint32_t)dblValue; } - CLogger_ErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); + LogErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); } else if (*string) { @@ -914,7 +914,7 @@ uint64_t CConfigParser::ReadUInt64(LPCTSTR section, LPCTSTR key, uint64_t defVal return (uint64_t)dblValue; } - CLogger_ErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); + LogErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); } else if (*string) { @@ -946,7 +946,7 @@ double CConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue) return value; } - CLogger_ErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); + LogErrorF(L"Formula: %s in key \"%s\" in [%s]", errMsg, key, section); } else if (*string) { @@ -972,7 +972,7 @@ bool CConfigParser::ParseFormula(const std::wstring& formula, double* resultValu const WCHAR* errMsg = MathParser::CheckedParse(string, resultValue); if (errMsg != NULL) { - CLogger_ErrorF(L"Formula: %s: %s", errMsg, string); + LogErrorF(L"Formula: %s: %s", errMsg, string); return false; } @@ -1069,7 +1069,7 @@ double CConfigParser::ParseDouble(LPCTSTR string, double defValue) return value; } - CLogger_ErrorF(L"Formula: %s: %s", errMsg, string); + LogErrorF(L"Formula: %s: %s", errMsg, string); } else if (*string) { @@ -1102,7 +1102,7 @@ int CConfigParser::ParseInt(LPCTSTR string, int defValue) return (int)dblValue; } - CLogger_ErrorF(L"Formula: %s: %s", errMsg, string); + LogErrorF(L"Formula: %s: %s", errMsg, string); } else if (*string) { @@ -1135,7 +1135,7 @@ uint32_t CConfigParser::ParseUInt(LPCTSTR string, uint32_t defValue) return (uint32_t)dblValue; } - CLogger_ErrorF(L"Formula: %s: %s", errMsg, string); + LogErrorF(L"Formula: %s: %s", errMsg, string); } else if (*string) { @@ -1168,7 +1168,7 @@ uint64_t CConfigParser::ParseUInt64(LPCTSTR string, uint64_t defValue) return (uint64_t)dblValue; } - CLogger_ErrorF(L"Formula: %s: %s", errMsg, string); + LogErrorF(L"Formula: %s: %s", errMsg, string); } else if (*string) { @@ -1295,7 +1295,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection // Verify whether the file exists if (_waccess(iniFile.c_str(), 0) == -1) { - CLogger_ErrorF(L"Unable to read file: %s", iniFile.c_str()); + LogErrorF(L"Unable to read file: %s", iniFile.c_str()); return; } @@ -1305,11 +1305,11 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection if (temporary) { - if (Rainmeter->GetDebug()) CLogger_DebugF(L"Reading file: %s (Temp: %s)", iniFile.c_str(), iniRead.c_str()); + if (Rainmeter->GetDebug()) LogDebugF(L"Reading file: %s (Temp: %s)", iniFile.c_str(), iniRead.c_str()); } else { - if (Rainmeter->GetDebug()) CLogger_DebugF(L"Reading file: %s", iniFile.c_str()); + if (Rainmeter->GetDebug()) LogDebugF(L"Reading file: %s", iniFile.c_str()); iniRead = iniFile; } @@ -1513,7 +1513,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection */ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue) { - // CLogger_DebugF(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size()); + // LogDebugF(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size()); std::wstring strTmp; strTmp.reserve(strSection.size() + 1 + strKey.size()); diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index edfd53fc..57911e6a 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -1083,7 +1083,7 @@ void CDialogAbout::CTabPlugins::Initialize() } else { - CLogger_ErrorF(L"Unable to load plugin: %s (%u)", tmpSz.c_str(), err); + LogErrorF(L"Unable to load plugin: %s (%u)", tmpSz.c_str(), err); } } while (FindNextFile(hSearch, &fd)); diff --git a/Library/Logger.h b/Library/Logger.h index ff277224..5cc1bb84 100644 --- a/Library/Logger.h +++ b/Library/Logger.h @@ -56,27 +56,6 @@ public: void Log(Level level, const WCHAR* msg); void LogF(Level level, const WCHAR* format, ...); - // Convenience functions. - static void Error(const WCHAR* msg) { GetInstance().Log(Level::Error, msg); } - static void Warning(const WCHAR* msg) { GetInstance().Log(Level::Warning, msg); } - static void Notice(const WCHAR* msg) { GetInstance().Log(Level::Notice, msg); } - static void Debug(const WCHAR* msg) { GetInstance().Log(Level::Debug, msg); } - - // TODO: Uncomment when VS supports variadic templates. - /* - template - static void ErrorF(const WCHAR* format, Args... args) { GetInstance().LogF(Level::Error, args...); } - - template - static void WarningF(const WCHAR* format, Args... args) { GetInstance().LogF(Level::Warning, args...); } - - template - static void NoticeF(const WCHAR* format, Args... args) { GetInstance().LogF(Level::Notice, args...); } - - template - static void DebugF(const WCHAR* format, Args... args) { GetInstance().LogF(Level::Debug, args...); } - */ - const std::wstring& GetLogFilePath() { return m_LogFilePath; } const std::list& GetEntries() { return m_Entries; } @@ -99,12 +78,31 @@ private: CRITICAL_SECTION m_CsLogDelay; }; +// Convenience functions. +#define RM_LOGGER_DEFINE_LOG_FUNCTION(name) \ + inline void Log ## name(const WCHAR* msg) \ + { \ + CLogger::GetInstance().Log(CLogger::Level::name, msg); \ + } \ +/* \ + template \ + inline void Log ## name ## F(const WCHAR* format, Args... args) \ + { \ + GetInstance().LogF(CLogger::Level::name, args...); \ + } +*/ + +RM_LOGGER_DEFINE_LOG_FUNCTION(Error) +RM_LOGGER_DEFINE_LOG_FUNCTION(Warning) +RM_LOGGER_DEFINE_LOG_FUNCTION(Notice) +RM_LOGGER_DEFINE_LOG_FUNCTION(Debug) + // FIXME: Temporary solution until VS support variadic macros. #define RM_LOGGER_LOGF_HELPER(name, format, ...) \ CLogger::GetInstance().LogF(CLogger::Level::name, format, __VA_ARGS__); -#define CLogger_ErrorF(format, ...) RM_LOGGER_LOGF_HELPER(Error, format, __VA_ARGS__) -#define CLogger_WarningF(format, ...) RM_LOGGER_LOGF_HELPER(Warning, format, __VA_ARGS__) -#define CLogger_NoticeF(format, ...) RM_LOGGER_LOGF_HELPER(Notice, format, __VA_ARGS__) -#define CLogger_DebugF(format, ...) RM_LOGGER_LOGF_HELPER(Debug, format, __VA_ARGS__) +#define LogErrorF(format, ...) RM_LOGGER_LOGF_HELPER(Error, format, __VA_ARGS__) +#define LogWarningF(format, ...) RM_LOGGER_LOGF_HELPER(Warning, format, __VA_ARGS__) +#define LogNoticeF(format, ...) RM_LOGGER_LOGF_HELPER(Notice, format, __VA_ARGS__) +#define LogDebugF(format, ...) RM_LOGGER_LOGF_HELPER(Debug, format, __VA_ARGS__) #endif \ No newline at end of file diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 0a34cfe3..68b920df 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -162,7 +162,7 @@ void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section) } if (!ParseSubstitute(subs)) { - CLogger_ErrorF(L"Measure: Invalid Substitute=%s", subs.c_str()); + LogErrorF(L"Measure: Invalid Substitute=%s", subs.c_str()); } } @@ -260,7 +260,7 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer) if (re == NULL) { MakePlainSubstitute(str, i); - CLogger_NoticeF(L"Substitute: %S", error); + LogNoticeF(L"Substitute: %S", error); } else { @@ -847,7 +847,7 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons return new CMeasureScript(meterWindow, name); } - CLogger_ErrorF(L"Measure=%s is not valid in [%s]", measure, name); + LogErrorF(L"Measure=%s is not valid in [%s]", measure, name); return NULL; } @@ -858,5 +858,5 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons */ void CMeasure::Command(const std::wstring& command) { - CLogger_WarningF(L"!CommandMeasure: Not supported by [%s]", m_Name.c_str()); + LogWarningF(L"!CommandMeasure: Not supported by [%s]", m_Name.c_str()); } diff --git a/Library/MeasureCPU.cpp b/Library/MeasureCPU.cpp index 8f437936..3e81a2a2 100644 --- a/Library/MeasureCPU.cpp +++ b/Library/MeasureCPU.cpp @@ -91,7 +91,7 @@ void CMeasureCPU::ReadOptions(CConfigParser& parser, const WCHAR* section) if (processor < 0 || processor > c_NumOfProcessors) { - CLogger_WarningF(L"CPU: Processor=%i invalid in [%s]", processor, section); + LogWarningF(L"CPU: Processor=%i invalid in [%s]", processor, section); processor = 0; } diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index e0e9eebd..5143f5eb 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -61,7 +61,7 @@ void CMeasureCalc::UpdateValue() { if (!m_ParseError) { - CLogger_ErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str()); + LogErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str()); m_ParseError = true; } } @@ -105,7 +105,7 @@ void CMeasureCalc::ReadOptions(CConfigParser& parser, const WCHAR* section) const WCHAR* errMsg = MathParser::Check(m_Formula.c_str()); if (errMsg != NULL) { - CLogger_ErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str()); + LogErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str()); m_Formula.clear(); } } diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index 3a27a116..9ae09d08 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -182,7 +182,7 @@ void CMeasureDiskSpace::ReadOptions(CConfigParser& parser, const WCHAR* section) m_Drive = parser.ReadString(section, L"Drive", L"C:\\"); if (m_Drive.empty()) { - CLogger::Warning(L"FreeDiskSpace: Drive= empty"); + LogWarning(L"FreeDiskSpace: Drive= empty"); m_Value = 0.0; m_MaxValue = 0.0; m_OldTotalBytes = 0; diff --git a/Library/MeasureNet.cpp b/Library/MeasureNet.cpp index 11edaeb7..a30ef3d4 100644 --- a/Library/MeasureNet.cpp +++ b/Library/MeasureNet.cpp @@ -80,8 +80,8 @@ void CMeasureNet::UpdateIFTable() if (Rainmeter->GetDebug() && logging) { - CLogger::Debug(L"------------------------------"); - CLogger_DebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables); + LogDebug(L"------------------------------"); + LogDebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables); for (size_t i = 0; i < c_NumOfTables; ++i) { @@ -108,14 +108,14 @@ void CMeasureNet::UpdateIFTable() break; } - CLogger_DebugF(L"%i: %s", (int)i + 1, ifTable->Table[i].Description); - CLogger_DebugF(L" Alias: %s", ifTable->Table[i].Alias); - CLogger_DebugF(L" Type=%s(%i), Hardware=%s, Filter=%s", + LogDebugF(L"%i: %s", (int)i + 1, ifTable->Table[i].Description); + LogDebugF(L" Alias: %s", ifTable->Table[i].Alias); + LogDebugF(L" Type=%s(%i), Hardware=%s, Filter=%s", type, ifTable->Table[i].Type, (ifTable->Table[i].InterfaceAndOperStatusFlags.HardwareInterface == 1) ? L"Yes" : L"No", (ifTable->Table[i].InterfaceAndOperStatusFlags.FilterInterface == 1) ? L"Yes" : L"No"); } - CLogger::Debug(L"------------------------------"); + LogDebug(L"------------------------------"); } } else @@ -173,8 +173,8 @@ void CMeasureNet::UpdateIFTable() if (Rainmeter->GetDebug() && logging) { - CLogger::Debug(L"------------------------------"); - CLogger_DebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables); + LogDebug(L"------------------------------"); + LogDebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables); for (size_t i = 0; i < c_NumOfTables; ++i) { @@ -204,10 +204,10 @@ void CMeasureNet::UpdateIFTable() break; } - CLogger_DebugF(L"%i: %.*S", (int)i + 1, ifTable->table[i].dwDescrLen, (char*)ifTable->table[i].bDescr); - CLogger_DebugF(L" Type=%s(%i)", type, ifTable->table[i].dwType); + LogDebugF(L"%i: %.*S", (int)i + 1, ifTable->table[i].dwDescrLen, (char*)ifTable->table[i].bDescr); + LogDebugF(L" Type=%s(%i)", type, ifTable->table[i].dwType); } - CLogger::Debug(L"------------------------------"); + LogDebug(L"------------------------------"); } } else diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 0a3593c2..4b991012 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -143,7 +143,7 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section) } if (!m_Plugin) { - CLogger_ErrorF(L"Plugin: \"%s\" not found", pluginName.c_str()); + LogErrorF(L"Plugin: \"%s\" not found", pluginName.c_str()); return; } } diff --git a/Library/MeasureRegistry.cpp b/Library/MeasureRegistry.cpp index 5bf63b87..16b639e1 100644 --- a/Library/MeasureRegistry.cpp +++ b/Library/MeasureRegistry.cpp @@ -135,7 +135,7 @@ void CMeasureRegistry::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"RegHKey=%s is not valid in [%s]", keyname, m_Name.c_str()); + LogErrorF(L"RegHKey=%s is not valid in [%s]", keyname, m_Name.c_str()); } m_RegKeyName = parser.ReadString(section, L"RegKey", L""); diff --git a/Library/MeasureScript.cpp b/Library/MeasureScript.cpp index 14e8484c..c08356e4 100644 --- a/Library/MeasureScript.cpp +++ b/Library/MeasureScript.cpp @@ -111,7 +111,7 @@ void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section) if (m_HasGetStringFunction) { - CLogger_WarningF(L"Script: Using deprecated GetStringValue() in [%s]", m_Name.c_str()); + LogWarningF(L"Script: Using deprecated GetStringValue() in [%s]", m_Name.c_str()); } lua_rawgeti(L, LUA_GLOBALSINDEX, m_LuaScript.GetRef()); @@ -171,7 +171,7 @@ void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section) } } - CLogger_ErrorF(L"Script: File not valid in [%s]", m_Name.c_str()); + LogErrorF(L"Script: File not valid in [%s]", m_Name.c_str()); UninitializeLuaScript(); } diff --git a/Library/MeasureTime.cpp b/Library/MeasureTime.cpp index 7b68169a..831983ea 100644 --- a/Library/MeasureTime.cpp +++ b/Library/MeasureTime.cpp @@ -73,7 +73,7 @@ void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, wcsftime(buf, bufLen, format, time); if (errno == EINVAL) { - CLogger_ErrorF(L"Time: \"Format=%s\" invalid in [%s]", format, m_Name.c_str()); + LogErrorF(L"Time: \"Format=%s\" invalid in [%s]", format, m_Name.c_str()); buf[0] = 0; } diff --git a/Library/MeasureUptime.cpp b/Library/MeasureUptime.cpp index 112f6db1..6324e8dd 100644 --- a/Library/MeasureUptime.cpp +++ b/Library/MeasureUptime.cpp @@ -95,7 +95,7 @@ const WCHAR* CMeasureUptime::GetStringValue() } __except (EXCEPTION_EXECUTE_HANDLER) { - CLogger_ErrorF(L"Uptime: \"Format=%s\" invalid in [%s]", m_Format.c_str(), m_Name.c_str()); + LogErrorF(L"Uptime: \"Format=%s\" invalid in [%s]", m_Format.c_str(), m_Name.c_str()); buffer[0] = 0; } diff --git a/Library/Meter.cpp b/Library/Meter.cpp index 6eec3b08..592ad188 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -351,7 +351,7 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section) delete m_Transformation; m_Transformation = NULL; - CLogger_ErrorF(L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str()); + LogErrorF(L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str()); } } @@ -409,7 +409,7 @@ CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHA return new CMeterButton(meterWindow, name); } - CLogger_ErrorF(L"Meter=%s is not valid in [%s]", meter, name); + LogErrorF(L"Meter=%s is not valid in [%s]", meter, name); return NULL; } @@ -443,7 +443,7 @@ bool CMeter::BindPrimaryMeasure(CConfigParser& parser, const WCHAR* section, boo } else if (!optional) { - CLogger_ErrorF(L"MeasureName=%s is not valid in [%s]", measureName.c_str(), section); + LogErrorF(L"MeasureName=%s is not valid in [%s]", measureName.c_str(), section); } return false; @@ -473,7 +473,7 @@ void CMeter::BindSecondaryMeasures(CConfigParser& parser, const WCHAR* section) { if (!measureName.empty()) { - CLogger_ErrorF(L"MeasureName%i=%s is not valid in [%s]", i, measureName.c_str(), section); + LogErrorF(L"MeasureName%i=%s is not valid in [%s]", i, measureName.c_str(), section); } break; diff --git a/Library/MeterBar.cpp b/Library/MeterBar.cpp index df2a46c9..cbfcd415 100644 --- a/Library/MeterBar.cpp +++ b/Library/MeterBar.cpp @@ -122,7 +122,7 @@ void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"BarOrientation=%s is not valid in [%s]", orientation, m_Name.c_str()); + LogErrorF(L"BarOrientation=%s is not valid in [%s]", orientation, m_Name.c_str()); } if (m_Initialized) diff --git a/Library/MeterBitmap.cpp b/Library/MeterBitmap.cpp index 7061771f..b5b32657 100644 --- a/Library/MeterBitmap.cpp +++ b/Library/MeterBitmap.cpp @@ -201,7 +201,7 @@ void CMeterBitmap::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"BitmapAlign=%s is not valid in [%s]", align, m_Name.c_str()); + LogErrorF(L"BitmapAlign=%s is not valid in [%s]", align, m_Name.c_str()); } if (m_Initialized) @@ -363,7 +363,7 @@ bool CMeterBitmap::Draw(Gfx::Canvas& canvas) } } -// CLogger_DebugF(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); +// LogDebugF(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); if (bitmap->GetHeight() > bitmap->GetWidth()) { @@ -432,7 +432,7 @@ bool CMeterBitmap::Draw(Gfx::Canvas& canvas) } } -// CLogger_DebugF(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); +// LogDebugF(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); if (bitmap->GetHeight() > bitmap->GetWidth()) { diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index e32c2257..6d600b57 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -120,7 +120,7 @@ void CMeterHistogram::Initialize() // A sanity check if (secondaryMeasure && !m_PrimaryImageName.empty() && (m_OverlapImageName.empty() || m_SecondaryImageName.empty())) { - CLogger::Warning(L"Histogram: SecondaryImage and BothImage not defined"); + LogWarning(L"Histogram: SecondaryImage and BothImage not defined"); m_PrimaryImage.DisposeImage(); m_SecondaryImage.DisposeImage(); @@ -262,7 +262,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"GraphStart=%s is not valid in [%s]", graph, m_Name.c_str()); + LogErrorF(L"GraphStart=%s is not valid in [%s]", graph, m_Name.c_str()); } graph = parser.ReadString(section, L"GraphOrientation", L"VERTICAL").c_str(); @@ -276,7 +276,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"GraphOrientation=%s is not valid in [%s]", graph, m_Name.c_str()); + LogErrorF(L"GraphOrientation=%s is not valid in [%s]", graph, m_Name.c_str()); } if (m_Initialized) diff --git a/Library/MeterLine.cpp b/Library/MeterLine.cpp index d65c3274..76ea7ae3 100644 --- a/Library/MeterLine.cpp +++ b/Library/MeterLine.cpp @@ -159,7 +159,7 @@ void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"GraphStart=%s is not valid in [%s]", graph, m_Name.c_str()); + LogErrorF(L"GraphStart=%s is not valid in [%s]", graph, m_Name.c_str()); } graph = parser.ReadString(section, L"GraphOrientation", L"VERTICAL").c_str(); @@ -173,7 +173,7 @@ void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"GraphOrientation=%s is not valid in [%s]", graph, m_Name.c_str()); + LogErrorF(L"GraphOrientation=%s is not valid in [%s]", graph, m_Name.c_str()); } if (m_Initialized) diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index 389a0815..2c530f0b 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -201,7 +201,7 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section) break; default: - CLogger_ErrorF(L"ClipString=%s is not valid in [%s]", clipping, m_Name.c_str()); + LogErrorF(L"ClipString=%s is not valid in [%s]", clipping, m_Name.c_str()); } m_FontFace = parser.ReadString(section, L"FontFace", L"Arial"); @@ -292,7 +292,7 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"StringCase=%s is not valid in [%s]", stringCase, m_Name.c_str()); + LogErrorF(L"StringCase=%s is not valid in [%s]", stringCase, m_Name.c_str()); } const WCHAR* style = parser.ReadString(section, L"StringStyle", L"NORMAL").c_str(); @@ -314,7 +314,7 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"StringStyle=%s is not valid in [%s]", style, m_Name.c_str()); + LogErrorF(L"StringStyle=%s is not valid in [%s]", style, m_Name.c_str()); } const WCHAR* effect = parser.ReadString(section, L"StringEffect", L"NONE").c_str(); @@ -332,7 +332,7 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"StringEffect=%s is not valid in [%s]", effect, m_Name.c_str()); + LogErrorF(L"StringEffect=%s is not valid in [%s]", effect, m_Name.c_str()); } if (m_Initialized && @@ -627,23 +627,23 @@ void CMeterString::EnumerateInstalledFontFamilies() } fonts += L", "; } - CLogger::Warning(fonts.c_str()); + LogWarning(fonts.c_str()); } else { - CLogger::Error(L"Font enumeration: GetFamilies failed"); + LogError(L"Font enumeration: GetFamilies failed"); } delete [] fontFamilies; } else { - CLogger::Warning(L"No installed fonts"); + LogWarning(L"No installed fonts"); } } else { - CLogger::Error(L"Font enumeration: InstalledFontCollection failed"); + LogError(L"Font enumeration: InstalledFontCollection failed"); } } @@ -651,10 +651,10 @@ void CMeterString::InitializeStatic() { if (Rainmeter->GetDebug()) { - CLogger::Debug(L"------------------------------"); - CLogger::Debug(L"* Font families:"); + LogDebug(L"------------------------------"); + LogDebug(L"* Font families:"); EnumerateInstalledFontFamilies(); - CLogger::Debug(L"------------------------------"); + LogDebug(L"------------------------------"); } } diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index ac79d3b0..68dfa9d4 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -410,7 +410,7 @@ void CMeterWindow::Refresh(bool init, bool all) notice += L'\\'; notice += m_FileName; notice += L'"'; - CLogger::Notice(notice.c_str()); + LogNotice(notice.c_str()); SetResizeWindowMode(RESIZEMODE_RESET); @@ -911,7 +911,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector& ar } else { - CLogger_WarningF(L"!CommandMeasure: [%s] not found", measure.c_str()); + LogWarningF(L"!CommandMeasure: [%s] not found", measure.c_str()); } } break; @@ -947,11 +947,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector& ar return; } - CLogger_WarningF(L"!PluginBang: [%s] not found", measure.c_str()); + LogWarningF(L"!PluginBang: [%s] not found", measure.c_str()); } else { - CLogger::Error(L"!PluginBang: Invalid parameters"); + LogError(L"!PluginBang: Invalid parameters"); } } break; @@ -1127,7 +1127,7 @@ void CMeterWindow::ShowMeter(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!ShowMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!ShowMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1149,7 +1149,7 @@ void CMeterWindow::HideMeter(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!HideMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!HideMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1178,7 +1178,7 @@ void CMeterWindow::ToggleMeter(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!ToggleMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!ToggleMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1201,7 +1201,7 @@ void CMeterWindow::MoveMeter(const std::wstring& name, int x, int y) } } - CLogger_ErrorF(L"!MoveMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); + LogErrorF(L"!MoveMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1251,7 +1251,7 @@ void CMeterWindow::UpdateMeter(const std::wstring& name, bool group) // Post-updates PostUpdate(bActiveTransition); - if (!group && bContinue) CLogger_ErrorF(L"!UpdateMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); + if (!group && bContinue) LogErrorF(L"!UpdateMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1272,7 +1272,7 @@ void CMeterWindow::EnableMeasure(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!EnableMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!EnableMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1293,7 +1293,7 @@ void CMeterWindow::DisableMeasure(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!DisableMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!DisableMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1321,7 +1321,7 @@ void CMeterWindow::ToggleMeasure(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!ToggleMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!ToggleMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1361,7 +1361,7 @@ void CMeterWindow::UpdateMeasure(const std::wstring& name, bool group) } } - if (!group) CLogger_ErrorF(L"!UpdateMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); + if (!group) LogErrorF(L"!UpdateMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -2109,7 +2109,7 @@ bool CMeterWindow::ReadSkin() { std::wstring error = L"Unable to load font: "; error += file.c_str(); - CLogger::Error(error.c_str()); + LogError(error.c_str()); } } } @@ -2142,7 +2142,7 @@ bool CMeterWindow::ReadSkin() { std::wstring error = L"Unable to load font: "; error += localFont; - CLogger::Error(error.c_str()); + LogError(error.c_str()); } } @@ -4348,7 +4348,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action) if (!m_MouseOver) { // If the mouse is over a meter it's also over the main window - //CLogger_DebugF(L"@Enter: %s", m_FolderPath.c_str()); + //LogDebugF(L"@Enter: %s", m_FolderPath.c_str()); m_MouseOver = true; SetMouseLeaveEvent(false); RegisterMouseInput(); @@ -4387,7 +4387,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action) !mouse.GetLeaveAction().empty() || button) { - //CLogger_DebugF(L"MeterEnter: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName()); + //LogDebugF(L"MeterEnter: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName()); (*j)->SetMouseOver(true); if (!mouse.GetOverAction().empty()) @@ -4413,7 +4413,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action) button->SetFocus(false); } - //CLogger_DebugF(L"MeterLeave: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName()); + //LogDebugF(L"MeterLeave: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName()); (*j)->SetMouseOver(false); const CMouse& mouse = (*j)->GetMouse(); @@ -4434,7 +4434,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action) { if (!m_MouseOver) { - //CLogger_DebugF(L"Enter: %s", m_FolderPath.c_str()); + //LogDebugF(L"Enter: %s", m_FolderPath.c_str()); m_MouseOver = true; SetMouseLeaveEvent(false); RegisterMouseInput(); @@ -4455,7 +4455,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action) // Mouse leave happens when the mouse is outside the window if (m_MouseOver) { - //CLogger_DebugF(L"Leave: %s", m_FolderPath.c_str()); + //LogDebugF(L"Leave: %s", m_FolderPath.c_str()); m_MouseOver = false; SetMouseLeaveEvent(true); UnregisterMouseInput(); @@ -4670,7 +4670,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam) else { // This meterwindow has been deactivated - CLogger::Warning(L"Unable to bang unloaded skin"); + LogWarning(L"Unable to bang unloaded skin"); } return TRUE; diff --git a/Library/Mouse.cpp b/Library/Mouse.cpp index 9f036605..0774f99e 100644 --- a/Library/Mouse.cpp +++ b/Library/Mouse.cpp @@ -130,7 +130,7 @@ void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section) if (!m_CustomCursor) { m_CursorType = MOUSECURSOR_ARROW; - CLogger_ErrorF(L"Invalid cursor: %s", cursorPath.c_str()); + LogErrorF(L"Invalid cursor: %s", cursorPath.c_str()); } } } diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index ea29fe39..43486155 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -238,7 +238,7 @@ void CRainmeter::BangWithArgs(BANGCOMMAND bang, std::vector& args, } else { - CLogger_ErrorF( L"Bang: Skin \"%s\" not found", folderPath.c_str()); + LogErrorF( L"Bang: Skin \"%s\" not found", folderPath.c_str()); } return; } @@ -265,13 +265,13 @@ void CRainmeter::BangWithArgs(BANGCOMMAND bang, std::vector& args, firstArg.erase(0, pos + 1); args.insert(args.begin(), newArg); - CLogger::Warning(L"!CommandMeasure: Two parameters required, only one given"); + LogWarning(L"!CommandMeasure: Two parameters required, only one given"); BangWithArgs(bang, args, numOfArgs, meterWindow); return; } } - CLogger::Error(L"Bang: Incorrect number of arguments"); + LogError(L"Bang: Incorrect number of arguments"); } } @@ -296,7 +296,7 @@ void CRainmeter::BangGroupWithArgs(BANGCOMMAND bang, std::vector& } else { - CLogger::Error(L"BangGroup: Incorrect number of arguments"); + LogError(L"BangGroup: Incorrect number of arguments"); } } @@ -330,7 +330,7 @@ void CRainmeter::Bang_ActivateSkin(std::vector& args) } } - CLogger::Error(L"!ActivateConfig: Invalid parameters"); + LogError(L"!ActivateConfig: Invalid parameters"); } /* @@ -344,7 +344,7 @@ void CRainmeter::Bang_DeactivateSkin(std::vector& args, CMeterWind meterWindow = GetMeterWindow(args[0]); if (!meterWindow) { - CLogger_WarningF(L"!DeactivateConfig: \"%s\" not active", args[0].c_str()); + LogWarningF(L"!DeactivateConfig: \"%s\" not active", args[0].c_str()); return; } } @@ -355,7 +355,7 @@ void CRainmeter::Bang_DeactivateSkin(std::vector& args, CMeterWind } else { - CLogger::Error(L"!DeactivateConfig: Invalid parameters"); + LogError(L"!DeactivateConfig: Invalid parameters"); } } @@ -379,7 +379,7 @@ void CRainmeter::Bang_ToggleSkin(std::vector& args) } else { - CLogger::Error(L"!ToggleConfig: Invalid parameters"); + LogError(L"!ToggleConfig: Invalid parameters"); } } @@ -402,7 +402,7 @@ void CRainmeter::Bang_DeactivateSkinGroup(std::vector& args) } else { - CLogger::Error(L"!DeactivateConfigGroup: Invalid parameters"); + LogError(L"!DeactivateConfigGroup: Invalid parameters"); } } @@ -442,7 +442,7 @@ void CRainmeter::Bang_SetClip(std::vector& args) } else { - CLogger::Error(L"!SetClip: Invalid parameter"); + LogError(L"!SetClip: Invalid parameter"); } } @@ -467,7 +467,7 @@ void CRainmeter::Bang_SetWallpaper(std::vector& args, CMeterWindow } else { - CLogger::Error(L"!SetWallpaper: Invalid parameters"); + LogError(L"!SetWallpaper: Invalid parameters"); } } @@ -482,7 +482,7 @@ void CRainmeter::Bang_SkinMenu(std::vector& args, CMeterWindow* me meterWindow = GetMeterWindow(args[0]); if (!meterWindow) { - CLogger_WarningF(L"!SkinMenu: \"%s\" not active", args[0].c_str()); + LogWarningF(L"!SkinMenu: \"%s\" not active", args[0].c_str()); return; } } @@ -494,7 +494,7 @@ void CRainmeter::Bang_SkinMenu(std::vector& args, CMeterWindow* me } else { - CLogger::Error(L"!SkinMenu: Invalid parameter"); + LogError(L"!SkinMenu: Invalid parameter"); } } @@ -521,7 +521,7 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo } else if (args.size() < 4) { - CLogger::Error(L"!WriteKeyValue: Invalid parameters"); + LogError(L"!WriteKeyValue: Invalid parameters"); return; } @@ -535,21 +535,21 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo if (strIniFile.find(L"..\\") != std::wstring::npos || strIniFile.find(L"../") != std::wstring::npos) { - CLogger_ErrorF(L"!WriteKeyValue: Illegal path: %s", iniFile); + LogErrorF(L"!WriteKeyValue: Illegal path: %s", iniFile); return; } if (_wcsnicmp(iniFile, m_SkinPath.c_str(), m_SkinPath.size()) != 0 && _wcsnicmp(iniFile, m_SettingsPath.c_str(), m_SettingsPath.size()) != 0) { - CLogger_ErrorF(L"!WriteKeyValue: Illegal path: %s", iniFile); + LogErrorF(L"!WriteKeyValue: Illegal path: %s", iniFile); return; } // Verify whether the file exists if (_waccess(iniFile, 0) == -1) { - CLogger_ErrorF(L"!WriteKeyValue: File not found: %s", iniFile); + LogErrorF(L"!WriteKeyValue: File not found: %s", iniFile); return; } @@ -557,7 +557,7 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo DWORD attr = GetFileAttributes(iniFile); if (attr == -1 || (attr & FILE_ATTRIBUTE_READONLY)) { - CLogger_WarningF(L"!WriteKeyValue: File is read-only: %s", iniFile); + LogWarningF(L"!WriteKeyValue: File is read-only: %s", iniFile); return; } @@ -573,11 +573,11 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo if (temporary) { - if (GetDebug()) CLogger_DebugF(L"!WriteKeyValue: Writing to: %s (Temp: %s)", iniFile, strIniWrite.c_str()); + if (GetDebug()) LogDebugF(L"!WriteKeyValue: Writing to: %s (Temp: %s)", iniFile, strIniWrite.c_str()); } else { - if (GetDebug()) CLogger_DebugF(L"!WriteKeyValue: Writing to: %s", iniFile); + if (GetDebug()) LogDebugF(L"!WriteKeyValue: Writing to: %s", iniFile); strIniWrite = strIniFile; } @@ -619,12 +619,12 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo // Copy the file back if (!CSystem::CopyFiles(strIniWrite, strIniFile)) { - CLogger_ErrorF(L"!WriteKeyValue: Failed to copy temporary file to original filepath: %s (Temp: %s)", iniFile, iniWrite); + LogErrorF(L"!WriteKeyValue: Failed to copy temporary file to original filepath: %s (Temp: %s)", iniFile, iniWrite); } } else // failed { - CLogger_ErrorF(L"!WriteKeyValue: Failed to write to: %s (Temp: %s)", iniFile, iniWrite); + LogErrorF(L"!WriteKeyValue: Failed to write to: %s (Temp: %s)", iniFile, iniWrite); } // Remove a temporary file @@ -634,7 +634,7 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo { if (write == 0) // failed { - CLogger_ErrorF(L"!WriteKeyValue: Failed to write to: %s", iniFile); + LogErrorF(L"!WriteKeyValue: Failed to write to: %s", iniFile); } } } @@ -665,7 +665,7 @@ void CRainmeter::Bang_Log(std::vector& args) } else if (_wcsicmp(type, L"NOTICE") != 0) { - CLogger::Error(L"!Log: Invalid type"); + LogError(L"!Log: Invalid type"); return; } } @@ -958,9 +958,9 @@ int CRainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) delete [] buffer; buffer = NULL; - CLogger_NoticeF(L"Path: %s", m_Path.c_str()); - CLogger_NoticeF(L"IniFile: %s", iniFile); - CLogger_NoticeF(L"SkinPath: %s", m_SkinPath.c_str()); + LogNoticeF(L"Path: %s", m_Path.c_str()); + LogNoticeF(L"IniFile: %s", iniFile); + LogNoticeF(L"SkinPath: %s", m_SkinPath.c_str()); // Extract volume path from program path // E.g.: @@ -1416,7 +1416,7 @@ void CRainmeter::ActivateSkin(int folderIndex, int fileIndex) { if (wcscmp(((*iter).second)->GetFileName().c_str(), fileSz) == 0) { - CLogger_WarningF(L"!ActivateConfig: \"%s\" already active", folderPath.c_str()); + LogWarningF(L"!ActivateConfig: \"%s\" already active", folderPath.c_str()); return; } else @@ -2279,7 +2279,7 @@ void CRainmeter::ExecuteBang(const WCHAR* bang, std::vector& args, } else { - CLogger_ErrorF(L"Invalid bang: !%s", bang); + LogErrorF(L"Invalid bang: !%s", bang); } } @@ -2486,7 +2486,7 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile) if (m_Debug) { - CLogger_NoticeF(L"ConfigEditor: %s", m_SkinEditor.c_str()); + LogNoticeF(L"ConfigEditor: %s", m_SkinEditor.c_str()); } m_TrayExecuteR = parser.ReadString(L"Rainmeter", L"TrayExecuteR", L"", false); @@ -2731,7 +2731,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset) { format += L" => FAIL"; } - CLogger_DebugF(format.c_str(), i, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top); + LogDebugF(format.c_str(), i, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top); } } changed = true; @@ -2754,7 +2754,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset) if (m_Debug) { - CLogger_DebugF(L"DesktopWorkAreaType: %s", m_DesktopWorkAreaType ? L"Margin" : L"Default"); + LogDebugF(L"DesktopWorkAreaType: %s", m_DesktopWorkAreaType ? L"Margin" : L"Default"); } for (UINT i = 0; i <= numOfMonitors; ++i) @@ -2806,7 +2806,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset) { format += L" => FAIL"; } - CLogger_DebugF(format.c_str(), r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top); + LogDebugF(format.c_str(), r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top); } } } @@ -3609,7 +3609,7 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath) DWORD ret = ExpandEnvironmentStrings(strPath.c_str(), buffer, bufSize); if (ret == 0) // Error { - CLogger_WarningF(L"Unable to expand environment strings in: %s", strPath.c_str()); + LogWarningF(L"Unable to expand environment strings in: %s", strPath.c_str()); break; } if (ret <= bufSize) // Fits in the buffer diff --git a/Library/System.cpp b/Library/System.cpp index c5a36baf..e89ea5f3 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -161,13 +161,13 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit if (Rainmeter->GetDebug()) { - CLogger::Debug(info.szDevice); - CLogger_DebugF(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags); - CLogger_DebugF(L" Handle : 0x%p", hMonitor); - CLogger_DebugF(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebug(info.szDevice); + LogDebugF(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags); + LogDebugF(L" Handle : 0x%p", hMonitor); + LogDebugF(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom, lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top); - CLogger_DebugF(L" WorkArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebugF(L" WorkArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top); } @@ -255,8 +255,8 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - CLogger::Debug(L"------------------------------"); - CLogger::Debug(L"* EnumDisplayDevices / EnumDisplaySettings API"); + LogDebug(L"------------------------------"); + LogDebug(L"* EnumDisplayDevices / EnumDisplaySettings API"); } DISPLAY_DEVICE dd = {sizeof(DISPLAY_DEVICE)}; @@ -276,7 +276,7 @@ void CSystem::SetMultiMonitorInfo() { deviceString.assign(dd.DeviceString, wcsnlen(dd.DeviceString, _countof(dd.DeviceString))); - CLogger::Debug(deviceName.c_str()); + LogDebug(deviceName.c_str()); if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE) { @@ -334,7 +334,7 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - CLogger_DebugF(L" Name : %s", monitor.monitorName.c_str()); + LogDebugF(L" Name : %s", monitor.monitorName.c_str()); } break; } @@ -342,8 +342,8 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - CLogger_DebugF(L" Adapter : %s", deviceString.c_str()); - CLogger_DebugF(L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags); + LogDebugF(L" Adapter : %s", deviceString.c_str()); + LogDebugF(L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags); } if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE) @@ -360,7 +360,7 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - CLogger_DebugF(L" Handle : 0x%p", monitor.handle); + LogDebugF(L" Handle : 0x%p", monitor.handle); } } @@ -374,10 +374,10 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - CLogger_DebugF(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebugF(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", info.rcMonitor.left, info.rcMonitor.top, info.rcMonitor.right, info.rcMonitor.bottom, info.rcMonitor.right - info.rcMonitor.left, info.rcMonitor.bottom - info.rcMonitor.top); - CLogger_DebugF(L" WorkArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebugF(L" WorkArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top); } @@ -404,8 +404,8 @@ void CSystem::SetMultiMonitorInfo() { if (logging) { - CLogger_DebugF(L" Adapter : %s", deviceString.c_str()); - CLogger_DebugF(L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags); + LogDebugF(L" Adapter : %s", deviceString.c_str()); + LogDebugF(L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags); } } ++dwDevice; @@ -415,15 +415,15 @@ void CSystem::SetMultiMonitorInfo() if (monitors.empty()) // Failed to enumerate the non-mirroring monitors { - CLogger::Warning(L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead."); + LogWarning(L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead."); c_Monitors.useEnumDisplayDevices = false; c_Monitors.useEnumDisplayMonitors = true; } if (logging) { - CLogger::Debug(L"------------------------------"); - CLogger::Debug(L"* EnumDisplayMonitors API"); + LogDebug(L"------------------------------"); + LogDebug(L"* EnumDisplayMonitors API"); } if (c_Monitors.useEnumDisplayMonitors) @@ -432,7 +432,7 @@ void CSystem::SetMultiMonitorInfo() if (monitors.empty()) // Failed to enumerate the monitors { - CLogger::Warning(L"Failed to enumerate monitors. Using dummy monitor info."); + LogWarning(L"Failed to enumerate monitors. Using dummy monitor info."); c_Monitors.useEnumDisplayMonitors = false; MonitorInfo monitor; @@ -466,7 +466,7 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - CLogger::Debug(L"------------------------------"); + LogDebug(L"------------------------------"); std::wstring method = L"* METHOD: "; if (c_Monitors.useEnumDisplayDevices) @@ -478,11 +478,11 @@ void CSystem::SetMultiMonitorInfo() { method += c_Monitors.useEnumDisplayMonitors ? L"EnumDisplayMonitors Mode" : L"Dummy Mode"; } - CLogger::Debug(method.c_str()); + LogDebug(method.c_str()); - CLogger_DebugF(L"* MONITORS: Count=%i, Primary=@%i", (int)monitors.size(), c_Monitors.primary); - CLogger::Debug(L"@0: Virtual screen"); - CLogger_DebugF(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebugF(L"* MONITORS: Count=%i, Primary=@%i", (int)monitors.size(), c_Monitors.primary); + LogDebug(L"@0: Virtual screen"); + LogDebugF(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", c_Monitors.vsL, c_Monitors.vsT, c_Monitors.vsL + c_Monitors.vsW, c_Monitors.vsT + c_Monitors.vsH, c_Monitors.vsW, c_Monitors.vsH); @@ -491,17 +491,17 @@ void CSystem::SetMultiMonitorInfo() { if ((*iter).active) { - CLogger_DebugF(L"@%i: %s (active), MonitorName: %s", i, (*iter).deviceName.c_str(), (*iter).monitorName.c_str()); - CLogger_DebugF(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebugF(L"@%i: %s (active), MonitorName: %s", i, (*iter).deviceName.c_str(), (*iter).monitorName.c_str()); + LogDebugF(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", (*iter).screen.left, (*iter).screen.top, (*iter).screen.right, (*iter).screen.bottom, (*iter).screen.right - (*iter).screen.left, (*iter).screen.bottom - (*iter).screen.top); } else { - CLogger_DebugF(L"@%i: %s (inactive), MonitorName: %s", i, (*iter).deviceName.c_str(), (*iter).monitorName.c_str()); + LogDebugF(L"@%i: %s (inactive), MonitorName: %s", i, (*iter).deviceName.c_str(), (*iter).monitorName.c_str()); } } - CLogger::Debug(L"------------------------------"); + LogDebug(L"------------------------------"); } } @@ -531,7 +531,7 @@ void CSystem::UpdateWorkareaInfo() if (Rainmeter->GetDebug()) { - CLogger_DebugF(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", + LogDebugF(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", i, info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top); @@ -696,7 +696,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam) if (logging) { - CLogger_DebugF(L"%c [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", + LogDebugF(L"%c [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetFolderPath().c_str(), (int)zPos); } } @@ -705,7 +705,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam) if (logging) { flag = (hwnd == CSystem::GetHelperWindow()) ? L'o' : ' '; - CLogger_DebugF(L"%c [%c] 0x%p : %s", flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className); + LogDebugF(L"%c [%c] 0x%p : %s", flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className); } } @@ -721,7 +721,7 @@ void CSystem::ChangeZPosInOrder() bool logging = Rainmeter->GetDebug() && DEBUG_VERBOSE; std::vector windowsInZOrder; - if (logging) CLogger::Debug(L"1: ----- BEFORE -----"); + if (logging) LogDebug(L"1: ----- BEFORE -----"); // Retrieve the Rainmeter's meter windows in Z-order EnumWindows(MyEnumWindowsProc, (LPARAM)(&windowsInZOrder)); @@ -753,7 +753,7 @@ void CSystem::ChangeZPosInOrder() if (logging) { - CLogger::Debug(L"2: ----- AFTER -----"); + LogDebug(L"2: ----- AFTER -----"); // Log all windows in Z-order EnumWindows(MyEnumWindowsProc, (LPARAM)NULL); @@ -796,7 +796,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW) { if (logging) { - CLogger_DebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - %s", + LogDebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - %s", c_HelperWindow, WorkerW, hwnd, windowText, className, (GetWindowLongPtr(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL"); } return; @@ -805,7 +805,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW) if (logging) { DWORD err = GetLastError(); - CLogger_DebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - FAILED (ErrorCode=0x%08X)", + LogDebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - FAILED (ErrorCode=0x%08X)", c_HelperWindow, WorkerW, hwnd, windowText, className, err); } } @@ -813,7 +813,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW) if (logging) { - CLogger_DebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_TOPMOST - %s", + LogDebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_TOPMOST - %s", c_HelperWindow, WorkerW, (GetWindowLongPtr(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL"); } } @@ -824,7 +824,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW) if (logging) { - CLogger_DebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_BOTTOM - %s", + LogDebugF(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_BOTTOM - %s", c_HelperWindow, WorkerW, (GetWindowLongPtr(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL"); } } @@ -851,7 +851,7 @@ bool CSystem::CheckDesktopState(HWND WorkerW) if (Rainmeter->GetDebug()) { - CLogger_DebugF(L"System: \"Show %s\" has been detected.", + LogDebugF(L"System: \"Show %s\" has been detected.", c_ShowDesktop ? L"desktop" : L"open windows"); } @@ -957,7 +957,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP break; case WM_DISPLAYCHANGE: - CLogger::Notice(L"System: Display settings changed"); + LogNotice(L"System: Display settings changed"); ClearMultiMonitorInfo(); CConfigParser::ClearMultiMonitorVariables(); case WM_SETTINGCHANGE: @@ -965,7 +965,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP { if (uMsg == WM_SETTINGCHANGE) // SPI_SETWORKAREA { - CLogger::Notice(L"System: Work area changed"); + LogNotice(L"System: Work area changed"); UpdateWorkareaInfo(); CConfigParser::UpdateWorkareaVariables(); } @@ -1144,7 +1144,7 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st { if (_waccess(wallpaper.c_str(), 0) == -1) { - CLogger_ErrorF(L"!SetWallpaper: Unable to read file: %s", wallpaper.c_str()); + LogErrorF(L"!SetWallpaper: Unable to read file: %s", wallpaper.c_str()); return; } @@ -1197,7 +1197,7 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st } else { - CLogger::Error(L"!SetWallpaper: Invalid style"); + LogError(L"!SetWallpaper: Invalid style"); } RegCloseKey(hKey); @@ -1239,7 +1239,7 @@ bool CSystem::CopyFiles(std::wstring from, std::wstring to, bool bMove) int result = SHFileOperation(&fo); if (result != 0) { - CLogger_ErrorF(L"Copy error: From %s to %s (%i)", from.c_str(), to.c_str(), result); + LogErrorF(L"Copy error: From %s to %s (%i)", from.c_str(), to.c_str(), result); return false; } return true; @@ -1282,7 +1282,7 @@ bool CSystem::RemoveFolder(std::wstring folder) int result = SHFileOperation(&fo); if (result != 0) { - CLogger_ErrorF(L"Unable to delete folder %s (%i)", folder.c_str(), result); + LogErrorF(L"Unable to delete folder %s (%i)", folder.c_str(), result); return false; } return true; @@ -1307,7 +1307,7 @@ void CSystem::UpdateIniFileMappingList() ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, (LPFILETIME)&ftLastWriteTime); if (ret == ERROR_SUCCESS) { - //CLogger_DebugF(L"IniFileMapping: numSubKeys=%u, ftLastWriteTime=%llu", numSubKeys, ftLastWriteTime); + //LogDebugF(L"IniFileMapping: numSubKeys=%u, ftLastWriteTime=%llu", numSubKeys, ftLastWriteTime); if (ftLastWriteTime != s_LastWriteTime || numSubKeys != c_IniFileMappings.size()) @@ -1396,7 +1396,7 @@ std::wstring CSystem::GetTemporaryFile(const std::wstring& iniFile) } else // failed { - CLogger_ErrorF(L"Unable to create temporary file to: %s", temporary.c_str()); + LogErrorF(L"Unable to create temporary file to: %s", temporary.c_str()); temporary = L"?"; } diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index 8362dfaf..fbe5afe8 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -66,12 +66,12 @@ public: if (iter != c_CacheMap.end()) { (*iter).second->AddRef(); - //CLogger_DebugF(L"* ADD: key=%s, ref=%i", key.c_str(), (*iter).second->GetRef()); + //LogDebugF(L"* ADD: key=%s, ref=%i", key.c_str(), (*iter).second->GetRef()); } else { c_CacheMap[key] = new ImageCache(bitmap, hBuffer); - //CLogger_DebugF(L"* ADD: key=%s, ref=new", key.c_str()); + //LogDebugF(L"* ADD: key=%s, ref=new", key.c_str()); } } @@ -82,11 +82,11 @@ public: { ImageCache* cache = (*iter).second; cache->Release(); - //CLogger_DebugF(L"* REMOVE: key=%s, ref=%i", key.c_str(), cache->GetRef()); + //LogDebugF(L"* REMOVE: key=%s, ref=%i", key.c_str(), cache->GetRef()); if (cache->IsInvalid()) { - //CLogger_DebugF(L"* EMPTY-ERASE: key=%s", key.c_str()); + //LogDebugF(L"* EMPTY-ERASE: key=%s", key.c_str()); c_CacheMap.erase(iter); delete cache; } @@ -375,7 +375,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) } else { - CLogger_ErrorF(L"%s: Unable to load: %s", m_Name, filename.c_str()); + LogErrorF(L"%s: Unable to load: %s", m_Name, filename.c_str()); } } CloseHandle(fileHandle); @@ -407,7 +407,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) } else { - CLogger_ErrorF(L"%s: Unable to open: %s", m_Name, filename.c_str()); + LogErrorF(L"%s: Unable to open: %s", m_Name, filename.c_str()); if (fileHandle != INVALID_HANDLE_VALUE) { @@ -673,7 +673,7 @@ void CTintedImage::ReadOptions(CConfigParser& parser, const WCHAR* section) if (m_CropMode < CROPMODE_TL || m_CropMode > CROPMODE_C) { m_CropMode = CROPMODE_TL; - CLogger_ErrorF(L"%s=%s (origin) is not valid in [%s]", m_OptionArray[OptionIndexImageCrop], crop, section); + LogErrorF(L"%s=%s (origin) is not valid in [%s]", m_OptionArray[OptionIndexImageCrop], crop, section); } } } @@ -777,7 +777,7 @@ void CTintedImage::ReadOptions(CConfigParser& parser, const WCHAR* section) } else { - CLogger_ErrorF(L"%s=%s (origin) is not valid in [%s]", m_OptionArray[OptionIndexImageFlip], flip, section); + LogErrorF(L"%s=%s (origin) is not valid in [%s]", m_OptionArray[OptionIndexImageFlip], flip, section); } if (!m_DisableTransform) diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 809f672e..77c48dbc 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -434,14 +434,14 @@ void CTrayWindow::ReadOptions(CConfigParser& parser) { delete m_Bitmap; m_Bitmap = NULL; - CLogger_WarningF(L"Bitmap image not found: %s", imagePath); + LogWarningF(L"Bitmap image not found: %s", imagePath); } } } } else { - CLogger_ErrorF(L"No such TrayMeter: %s", type); + LogErrorF(L"No such TrayMeter: %s", type); } TryAddTrayIcon(); diff --git a/Library/lua/LuaManager.cpp b/Library/lua/LuaManager.cpp index 786a2ebc..d754b9e5 100644 --- a/Library/lua/LuaManager.cpp +++ b/Library/lua/LuaManager.cpp @@ -70,7 +70,7 @@ void LuaManager::ReportErrors(lua_State* L, const std::wstring& file) std::wstring str(file, file.find_last_of(L'\\') + 1); str += StringUtil::Widen(error); - CLogger_ErrorF(L"Script: %s", str.c_str()); + LogErrorF(L"Script: %s", str.c_str()); } void LuaManager::PushWide(lua_State* L, const WCHAR* str) diff --git a/Library/lua/glue/LuaGlobal.cpp b/Library/lua/glue/LuaGlobal.cpp index a8b5bf61..fa95b375 100644 --- a/Library/lua/glue/LuaGlobal.cpp +++ b/Library/lua/glue/LuaGlobal.cpp @@ -54,7 +54,7 @@ static int Print(lua_State* L) lua_pop(L, 1); } - CLogger::Debug(StringUtil::Widen(message).c_str()); + LogDebug(StringUtil::Widen(message).c_str()); return 0; }