diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index cf4cf694..2e09d90e 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -145,7 +145,7 @@ void CConfigParser::ReadVariables() */ void CConfigParser::SetVariable(std::map& variables, const std::wstring& strVariable, const std::wstring& strValue) { - // DebugLog(L"Variable: %s=%s (size=%i)", strVariable.c_str(), strValue.c_str(), (int)m_Variables.size()); + // LogWithArgs(LOG_DEBUG, L"Variable: %s=%s (size=%i)", strVariable.c_str(), strValue.c_str(), (int)m_Variables.size()); std::wstring strTmp(strVariable); std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower); @@ -613,7 +613,7 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT const std::wstring& strStyle = GetValue(strSection, key, strDefault); - //DebugLog(L"[%s] %s (from [%s]) : strDefault=%s (0x%p), strStyle=%s (0x%p)", + //LogWithArgs(LOG_DEBUG, L"[%s] %s (from [%s]) : strDefault=%s (0x%p), strStyle=%s (0x%p)", // section, key, strSection.c_str(), strDefault.c_str(), &strDefault, strStyle.c_str(), &strStyle); if (&strStyle != &strDefault) @@ -659,11 +659,15 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT } } + SetVariable(L"CURRENTSECTION", section); // Set temporarily + if (ReplaceVariables(result)) { m_LastReplaced = true; } + SetVariable(L"CURRENTSECTION", L""); // Reset + if (bReplaceMeasures && ReplaceMeasures(result)) { m_LastReplaced = true; @@ -750,7 +754,7 @@ double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue) char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(result.substr(1, result.size() - 2).c_str()).c_str(), &resultValue); if (errMsg != NULL) { - LSLog(LOG_ERROR, APPNAME, ConvertToWide(errMsg).c_str()); + Log(LOG_ERROR, ConvertToWide(errMsg).c_str()); } return resultValue; @@ -770,7 +774,7 @@ int CConfigParser::ReadFormula(const std::wstring& result, double* resultValue) if (errMsg != NULL) { - LSLog(LOG_ERROR, APPNAME, ConvertToWide(errMsg).c_str()); + Log(LOG_ERROR, ConvertToWide(errMsg).c_str()); return -1; } @@ -1187,7 +1191,7 @@ void CConfigParser::ReadIniFile(const std::vector& iniFileMappings */ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue) { - // DebugLog(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size()); + // LogWithArgs(LOG_DEBUG, L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size()); std::wstring strTmpSection(strSection); std::wstring strTmpKey(strKey); diff --git a/Library/Litestep.cpp b/Library/Litestep.cpp index 3c5fd637..64114c9f 100644 --- a/Library/Litestep.cpp +++ b/Library/Litestep.cpp @@ -605,28 +605,9 @@ void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* // Do nothing. } -// DebugLog function preserved to comply with lines 32-36 in Litestep.h, -// it is unclear whether they/it are required or used. -void DebugLog(const WCHAR* format, ... ) +void Log(int nLevel, const WCHAR* message) { - WCHAR buffer[4096]; - va_list args; - va_start( args, format ); - - _invalid_parameter_handler oldHandler = _set_invalid_parameter_handler(RmNullCRTInvalidParameterHandler); - _CrtSetReportMode(_CRT_ASSERT, 0); - - errno = 0; - _vsnwprintf_s( buffer, _TRUNCATE, format, args ); - if (errno != 0) - { - _snwprintf_s(buffer, _TRUNCATE, L"DebugLog internal error: %s", format); - } - - _set_invalid_parameter_handler(oldHandler); - - LSLog(LOG_DEBUG, L"Rainmeter", buffer); - va_end(args); + LSLog(nLevel, L"Rainmeter", message); } void LogWithArgs(int nLevel, const WCHAR* format, ... ) diff --git a/Library/Litestep.h b/Library/Litestep.h index 0535816b..418348c5 100644 --- a/Library/Litestep.h +++ b/Library/Litestep.h @@ -29,12 +29,6 @@ #define LM_REGISTERMESSAGE 9263 #define LM_UNREGISTERMESSAGE 9264 -#ifdef _DEBUG -#define DEBUGLOG DebugLog -#else -#define DEBUGLOG // -#endif - typedef void (BangCommand)(HWND sender, LPCSTR args); @@ -54,8 +48,9 @@ void VarExpansion(LPSTR buffer, LPCSTR value); void LSSetVariable(const BSTR name, const BSTR value); void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved); -void DebugLog(const WCHAR* message, ... ); // Left to support lines 32-36 in this file, I am not sure what they do. -void LogWithArgs(int nLevel, const WCHAR* message, ... ); // Replacement for DebugLog(), has the same functionality but has the option to set teh Log Level. + +void Log(int nLevel, const WCHAR* message); // Wrapper for LSLog(). +void LogWithArgs(int nLevel, const WCHAR* format, ... ); // Replacement for DebugLog(), has the same functionality but has the option to set teh Log Level. void ResetLoggingFlag(); diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index d43015a5..b68070f0 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -84,7 +84,7 @@ bool CMeasureCalc::Update() char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(m_Formula.c_str()).c_str(), &m_Value); if (errMsg != NULL) { - LSLog(LOG_ERROR, APPNAME, ConvertToWide(errMsg).c_str()); + Log(LOG_ERROR, ConvertToWide(errMsg).c_str()); } return PostUpdate(); diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index f1a4fdce..c81e6fed 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -152,7 +152,7 @@ void CMeasureDiskSpace::ReadConfig(CConfigParser& parser, const WCHAR* section) m_Drive = parser.ReadString(section, L"Drive", L"C:\\"); if (m_Drive.empty()) { - LSLog(LOG_WARNING, APPNAME, L"Drive path is not given."); + Log(LOG_WARNING, L"Drive path is not given."); m_Value = 0.0; m_MaxValue = 0.0; m_OldTotalBytes = 0; diff --git a/Library/MeasureNet.cpp b/Library/MeasureNet.cpp index 5e9a676c..fdee3715 100644 --- a/Library/MeasureNet.cpp +++ b/Library/MeasureNet.cpp @@ -113,7 +113,7 @@ void CMeasureNet::UpdateIFTable() if (CRainmeter::GetDebug() && logging) { - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); + Log(LOG_DEBUG, L"------------------------------"); LogWithArgs(LOG_DEBUG, L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables); for (size_t i = 0; i < c_NumOfTables; ++i) @@ -151,7 +151,7 @@ void CMeasureNet::UpdateIFTable() (ifTable->Table[i].InterfaceAndOperStatusFlags.HardwareInterface == 1) ? L"Yes" : L"No", (ifTable->Table[i].InterfaceAndOperStatusFlags.FilterInterface == 1) ? L"Yes" : L"No"); } - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); + Log(LOG_DEBUG, L"------------------------------"); } } else @@ -209,7 +209,7 @@ void CMeasureNet::UpdateIFTable() if (CRainmeter::GetDebug() && logging) { - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); + Log(LOG_DEBUG, L"------------------------------"); LogWithArgs(LOG_DEBUG, L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables); for (size_t i = 0; i < c_NumOfTables; ++i) @@ -246,7 +246,7 @@ void CMeasureNet::UpdateIFTable() LogWithArgs(LOG_DEBUG, L" Type=%s(%i)", type.c_str(), ifTable->table[i].dwType); } - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); + Log(LOG_DEBUG, L"------------------------------"); } } else diff --git a/Library/MeterBitmap.cpp b/Library/MeterBitmap.cpp index 8f28351a..2c6eb1d4 100644 --- a/Library/MeterBitmap.cpp +++ b/Library/MeterBitmap.cpp @@ -385,7 +385,7 @@ bool CMeterBitmap::Draw(Graphics& graphics) } } -// DebugLog(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); +// LogWithArgs(LOG_DEBUG, L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); if(bitmap->GetHeight() > bitmap->GetWidth()) { @@ -451,7 +451,7 @@ bool CMeterBitmap::Draw(Graphics& graphics) } } -// DebugLog(L"[%u] Value: %f Frame: %i (Transition = %s)", GetTickCount(), m_Value, frame, m_TransitionStartTicks > 0 ? L"true" : L"false"); +// LogWithArgs(LOG_DEBUG, 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 65430a97..73e61b9a 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -106,7 +106,7 @@ void CMeterHistogram::Initialize() // A sanity check if (m_SecondaryMeasure && !m_PrimaryImageName.empty() && (m_BothImageName.empty() || m_SecondaryImageName.empty())) { - LSLog(LOG_WARNING, APPNAME, L"You need to define SecondaryImage and BothImage also!"); + Log(LOG_WARNING, L"You need to define SecondaryImage and BothImage also!"); m_PrimaryImage.DisposeImage(); m_SecondaryImage.DisposeImage(); diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index 0a334e73..701484f8 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -162,7 +162,7 @@ void CMeterString::Initialize() if(Ok != status) { std::wstring error = L"Couldn't load font family: " + m_FontFace; - LSLog(LOG_ERROR, APPNAME, error.c_str()); + Log(LOG_ERROR, error.c_str()); delete m_FontFamily; m_FontFamily = NULL; @@ -725,22 +725,22 @@ void CMeterString::EnumerateInstalledFontFamilies() } fonts += L", "; } - LSLog(LOG_NOTICE, APPNAME, fonts.c_str()); + Log(LOG_NOTICE, fonts.c_str()); } else { - LSLog(LOG_ERROR, APPNAME, L"Failed to enumerate installed font families: GetFamilies() failed."); + Log(LOG_ERROR, L"Failed to enumerate installed font families: GetFamilies() failed."); } delete [] fontFamilies; } else { - LSLog(LOG_WARNING, APPNAME, L"There are no installed font families!"); + Log(LOG_WARNING, L"There are no installed font families!"); } } else { - LSLog(LOG_ERROR, APPNAME, L"Failed to enumerate installed font families: InstalledFontCollection() failed."); + Log(LOG_ERROR, L"Failed to enumerate installed font families: InstalledFontCollection() failed."); } } \ No newline at end of file diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 42f626a9..9e55fdde 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -259,7 +259,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter) } } - LSLog(LOG_NOTICE, APPNAME, L"Initialization successful."); + Log(LOG_NOTICE, L"Initialization successful."); return 0; } @@ -307,7 +307,7 @@ void CMeterWindow::Refresh(bool init, bool all) notice += L"\\"; notice += m_SkinIniFile; notice += L"\""; - LSLog(LOG_NOTICE, APPNAME, notice.c_str()); + Log(LOG_NOTICE, notice.c_str()); m_Refreshing = true; @@ -759,7 +759,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg) } else { - LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterMove"); + Log(LOG_ERROR, L"Unable to parse parameters for !RainmeterMove"); } break; @@ -871,12 +871,12 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg) } else { - LSLog(LOG_ERROR, APPNAME, L"Unable to parse coordinates for !RainmeterMoveMeter"); + Log(LOG_ERROR, L"Unable to parse coordinates for !RainmeterMoveMeter"); } } else { - LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterMoveMeter"); + Log(LOG_ERROR, L"Unable to parse parameters for !RainmeterMoveMeter"); } break; @@ -923,7 +923,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg) } else { - LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterPluginBang"); + Log(LOG_ERROR, L"Unable to parse parameters for !RainmeterPluginBang"); } } break; @@ -954,7 +954,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg) } else { - LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterSetVariable"); + Log(LOG_ERROR, L"Unable to parse parameters for !RainmeterSetVariable"); } break; } @@ -1187,7 +1187,7 @@ void CMeterWindow::WindowToScreen() { if (CSystem::GetMonitorCount() == 0) { - LSLog(LOG_ERROR, APPNAME, L"There are no monitors. WindowToScreen function fails."); + Log(LOG_ERROR, L"There are no monitors. WindowToScreen function fails."); return; } @@ -1399,7 +1399,7 @@ void CMeterWindow::ScreenToWindow() if (monitors.empty()) { - LSLog(LOG_ERROR, APPNAME, L"There are no monitors. ScreenToWindow function fails."); + Log(LOG_ERROR, L"There are no monitors. ScreenToWindow function fails."); return; } @@ -1709,7 +1709,7 @@ bool CMeterWindow::ReadSkin() message += L"\\"; message += m_SkinIniFile; message += L"\": Ini-file not found."; - LSLog(LOG_WARNING, APPNAME, message.c_str()); + Log(LOG_WARNING, message.c_str()); MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return false; } @@ -1826,7 +1826,7 @@ bool CMeterWindow::ReadSkin() if(nResults != Ok) { std::wstring error = L"Couldn't load font file: " + localFont; - LSLog(LOG_ERROR, APPNAME, error.c_str()); + Log(LOG_ERROR, error.c_str()); } } @@ -1869,7 +1869,7 @@ bool CMeterWindow::ReadSkin() if(nResults != Ok) { std::wstring error = L"Couldn't load font file: " + localFont; - LSLog(LOG_ERROR, APPNAME, error.c_str()); + Log(LOG_ERROR, error.c_str()); } } } @@ -2753,7 +2753,7 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam) // GetWindowRect(m_Window, &rect); // if (rect.left != m_WindowX && rect.top != m_WindowY) // { -// DebugLog(L"Window position has been changed. Moving it back to the place it belongs."); +// LogWithArgs(LOG_DEBUG, L"Window position has been changed. Moving it back to the place it belongs."); // SetWindowPos(m_Window, NULL, m_WindowX, m_WindowY, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); // } // } @@ -4215,7 +4215,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) if (!m_MouseOver) { // If the mouse is over a meter it's also over the main window - //DebugLog(L"@Enter: %s", m_SkinName.c_str()); + //LogWithArgs(LOG_DEBUG, L"@Enter: %s", m_SkinName.c_str()); m_MouseOver = true; SetMouseLeaveEvent(false); @@ -4257,7 +4257,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) !((*j)->GetMouseLeaveAction().empty()) || button) { - //DebugLog(L"MeterEnter: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); + //LogWithArgs(LOG_DEBUG, L"MeterEnter: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); (*j)->SetMouseOver(true); if (!((*j)->GetMouseOverAction().empty())) @@ -4288,7 +4288,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) } } - //DebugLog(L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); + //LogWithArgs(LOG_DEBUG, L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); (*j)->SetMouseOver(false); if (!((*j)->GetMouseLeaveAction().empty())) @@ -4308,7 +4308,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) { if (!m_MouseOver) { - //DebugLog(L"Enter: %s", m_SkinName.c_str()); + //LogWithArgs(LOG_DEBUG, L"Enter: %s", m_SkinName.c_str()); m_MouseOver = true; SetMouseLeaveEvent(false); @@ -4327,7 +4327,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) // Mouse leave happens when the mouse is outside the window if (m_MouseOver) { - //DebugLog(L"Leave: %s", m_SkinName.c_str()); + //LogWithArgs(LOG_DEBUG, L"Leave: %s", m_SkinName.c_str()); m_MouseOver = false; SetMouseLeaveEvent(true); @@ -4536,7 +4536,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam) } if (!found) { - LSLog(LOG_WARNING, APPNAME, L"Unable to send the !bang to a deactivated config."); + Log(LOG_WARNING, L"Unable to send the !bang to a deactivated config."); return 0; // This meterwindow has been deactivated } diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 42afd887..60d8d589 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -405,7 +405,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs) else { std::wstring dbg = L"Unknown config name: " + config; - LSLog(LOG_NOTICE, APPNAME, dbg.c_str()); + Log(LOG_NOTICE, dbg.c_str()); } } else @@ -421,7 +421,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs) } else { - LSLog(LOG_WARNING, APPNAME, L"Incorrect number of arguments for the bang!"); + Log(LOG_WARNING, L"Incorrect number of arguments for the bang!"); } } } @@ -459,7 +459,7 @@ void BangGroupWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs) } else { - LSLog(LOG_WARNING, APPNAME, L"Incorrect number of arguments for the group bang!"); + Log(LOG_WARNING, L"Incorrect number of arguments for the group bang!"); } } } @@ -1140,7 +1140,7 @@ void RainmeterActivateConfigWide(const WCHAR* arg) else { // If we got this far, something went wrong - LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterActivateConfig"); + Log(LOG_WARNING, L"Unable to parse the arguments for !RainmeterActivateConfig"); } } } @@ -1169,7 +1169,7 @@ void RainmeterDeactivateConfigWide(const WCHAR* arg) } else { - LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfig"); + Log(LOG_WARNING, L"Unable to parse the arguments for !RainmeterDeactivateConfig"); } } } @@ -1200,7 +1200,7 @@ void RainmeterToggleConfigWide(const WCHAR* arg) } else { - LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterToggleConfig"); + Log(LOG_WARNING, L"Unable to parse the arguments for !RainmeterToggleConfig"); } } } @@ -1230,7 +1230,7 @@ void RainmeterDeactivateConfigGroupWide(const WCHAR* arg) } else { - LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfigGroup"); + Log(LOG_WARNING, L"Unable to parse the arguments for !RainmeterDeactivateConfigGroup"); } } } @@ -1290,7 +1290,7 @@ void RainmeterSkinMenuWide(const WCHAR* arg) } else { - LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterSkinMenu"); + Log(LOG_WARNING, L"Unable to parse the arguments for !RainmeterSkinMenu"); } } } @@ -1457,7 +1457,7 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg) } else { - LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterWriteKeyValue"); + Log(LOG_WARNING, L"Unable to parse the arguments for !RainmeterWriteKeyValue"); } } } @@ -1730,7 +1730,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath) } else { - LSLog(LOG_WARNING, APPNAME, L"Unable to get the My Documents location."); + Log(LOG_WARNING, L"Unable to get the My Documents location."); } } WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str()); @@ -1807,7 +1807,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath) if (c_Debug) { - LSLog(LOG_DEBUG, APPNAME, L"Enumerating installed font families..."); + Log(LOG_DEBUG, L"Enumerating installed font families..."); CMeterString::EnumerateInstalledFontFamilies(); } @@ -1938,7 +1938,7 @@ void CRainmeter::CheckSkinVersions() for (size_t i = 0; i < menu.size(); ++i) { - // DebugLog(L"%s", menu[i].name.c_str()); + // LogWithArgs(LOG_DEBUG, L"%s", menu[i].name.c_str()); // Read the version files std::wstring strNewVersionFile = strMainSkinsPath + menu[i].name; @@ -1955,21 +1955,21 @@ void CRainmeter::CheckSkinVersions() if (getline(newFile, strVersion)) { strVersionNew = ConvertToWide(strVersion.c_str()); - // DebugLog(L"New: %s", strVersionNew.c_str()); + // LogWithArgs(LOG_DEBUG, L"New: %s", strVersionNew.c_str()); // Compare with the version entry in the Rainmeter.ini WCHAR tmpSz[256] = {0}; GetPrivateProfileString(menu[i].name.c_str(), L"Version", L"", tmpSz, 256, m_IniFile.c_str()); strVersionInIni = tmpSz; - // DebugLog(L"In Ini: %s", strVersionInIni.c_str()); + // LogWithArgs(LOG_DEBUG, L"In Ini: %s", strVersionInIni.c_str()); // Compare with the version file in the skin folder std::ifstream currentFile(strCurrentVersionFile.c_str(), std::ios_base::in); if (getline(currentFile, strVersion)) { strVersionCurrent = ConvertToWide(strVersion.c_str()); - // DebugLog(L"Current: %s", strVersionCurrent.c_str()); + // LogWithArgs(LOG_DEBUG, L"Current: %s", strVersionCurrent.c_str()); } } @@ -2164,7 +2164,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex) message += L"\\"; message += skinIniFile; message += L"\": Ini-file not found."; - LSLog(LOG_WARNING, APPNAME, message.c_str()); + Log(LOG_WARNING, message.c_str()); MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return; } @@ -3315,7 +3315,7 @@ void CRainmeter::RefreshAll() message += L"\\"; message += skinIniFile; message += L"\": Ini-file not found."; - LSLog(LOG_WARNING, APPNAME, message.c_str()); + Log(LOG_WARNING, message.c_str()); MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); } break; @@ -3330,7 +3330,7 @@ void CRainmeter::RefreshAll() std::wstring message = L"Unable to refresh config \"" + skinConfig; message += L"\": Config not found."; - LSLog(LOG_WARNING, APPNAME, message.c_str()); + Log(LOG_WARNING, message.c_str()); MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); } continue; @@ -4122,7 +4122,7 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation) } if (!bSuccess) { - LSLog(LOG_WARNING, APPNAME, L"The Rainmeter.ini file is NOT writable."); + Log(LOG_WARNING, L"The Rainmeter.ini file is NOT writable."); std::wstring error = L"The Rainmeter.ini file is not writable. This means that the\n" L"application will not be able to save any settings permanently.\n\n"; @@ -4153,7 +4153,7 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation) } else { - LSLog(LOG_NOTICE, APPNAME, L"The Rainmeter.ini file is writable."); + Log(LOG_NOTICE, L"The Rainmeter.ini file is writable."); } } diff --git a/Library/System.cpp b/Library/System.cpp index 25a3acae..bca72aa0 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -171,7 +171,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit if (CRainmeter::GetDebug()) { - LSLog(LOG_DEBUG, APPNAME, info.szDevice); + Log(LOG_DEBUG, info.szDevice); LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags); LogWithArgs(LOG_DEBUG, L" Handle : 0x%p", hMonitor); LogWithArgs(LOG_DEBUG, L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)", @@ -270,8 +270,8 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); - LSLog(LOG_DEBUG, APPNAME, L"* EnumDisplayDevices / EnumDisplaySettings API"); + Log(LOG_DEBUG, L"------------------------------"); + Log(LOG_DEBUG, L"* EnumDisplayDevices / EnumDisplaySettings API"); } DISPLAY_DEVICE dd = {0}; @@ -287,7 +287,7 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - LSLog(LOG_DEBUG, APPNAME, dd.DeviceName); + Log(LOG_DEBUG, dd.DeviceName); if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE) { @@ -427,15 +427,15 @@ void CSystem::SetMultiMonitorInfo() if (monitors.empty()) // Failed to enumerate the non-mirroring monitors { - LSLog(LOG_WARNING, APPNAME, L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead."); + Log(LOG_WARNING, L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead."); c_Monitors.useEnumDisplayDevices = false; c_Monitors.useEnumDisplayMonitors = true; } if (logging) { - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); - LSLog(LOG_DEBUG, APPNAME, L"* EnumDisplayMonitors API"); + Log(LOG_DEBUG, L"------------------------------"); + Log(LOG_DEBUG, L"* EnumDisplayMonitors API"); } if (c_Monitors.useEnumDisplayMonitors) @@ -444,7 +444,7 @@ void CSystem::SetMultiMonitorInfo() if (monitors.empty()) // Failed to enumerate the monitors { - LSLog(LOG_WARNING, APPNAME, L"Failed to enumerate the monitors. Prepares the dummy monitor information."); + Log(LOG_WARNING, L"Failed to enumerate the monitors. Prepares the dummy monitor information."); c_Monitors.useEnumDisplayMonitors = false; MONITOR_INFO monitor = {0}; @@ -473,7 +473,7 @@ void CSystem::SetMultiMonitorInfo() if (logging) { - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); + Log(LOG_DEBUG, L"------------------------------"); std::wstring method = L"* METHOD: "; if (c_Monitors.useEnumDisplayDevices) @@ -485,10 +485,10 @@ void CSystem::SetMultiMonitorInfo() { method += c_Monitors.useEnumDisplayMonitors ? L"EnumDisplayMonitors Mode" : L"Dummy Mode"; } - LSLog(LOG_DEBUG, APPNAME, method.c_str()); + Log(LOG_DEBUG, method.c_str()); LogWithArgs(LOG_DEBUG, L"* MONITORS: Count=%i, Primary=@%i", (int)monitors.size(), c_Monitors.primary); - LSLog(LOG_DEBUG, APPNAME, L"@0: Virtual screen"); + Log(LOG_DEBUG, L"@0: Virtual screen"); LogWithArgs(LOG_DEBUG, 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); @@ -507,7 +507,7 @@ void CSystem::SetMultiMonitorInfo() LogWithArgs(LOG_DEBUG, L"@%i: %s (inactive), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName); } } - LSLog(LOG_DEBUG, APPNAME, L"------------------------------"); + Log(LOG_DEBUG, L"------------------------------"); } } @@ -717,7 +717,7 @@ void CSystem::ChangeZPosInOrder() bool logging = CRainmeter::GetDebug() && DEBUG_VERBOSE; std::vector windowsInZOrder; - if (logging) LSLog(LOG_DEBUG, APPNAME, L"1: ----- BEFORE -----"); + if (logging) Log(LOG_DEBUG, L"1: ----- BEFORE -----"); // Retrieve the Rainmeter's meter windows in Z-order EnumWindows(MyEnumWindowsProc, (LPARAM)(&windowsInZOrder)); @@ -747,7 +747,7 @@ void CSystem::ChangeZPosInOrder() if (logging) { - LSLog(LOG_DEBUG, APPNAME, L"2: ----- AFTER -----"); + Log(LOG_DEBUG, L"2: ----- AFTER -----"); // Log all windows in Z-order EnumWindows(MyEnumWindowsProc, (LPARAM)NULL); @@ -944,7 +944,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP break; case WM_DWMCOMPOSITIONCHANGED: - LSLog(LOG_NOTICE, APPNAME, L"System: DWM desktop composition has been changed."); + Log(LOG_NOTICE, L"System: DWM desktop composition has been changed."); KillTimer(c_Window, TIMER_SHOWDESKTOP); KillTimer(c_Window, TIMER_COMPOSITION); @@ -963,7 +963,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP return 0; case WM_DISPLAYCHANGE: - LSLog(LOG_NOTICE, APPNAME, L"System: Display setting has been changed."); + Log(LOG_NOTICE, L"System: Display setting has been changed."); ClearMultiMonitorInfo(); CConfigParser::ClearMultiMonitorVariables(); case WM_SETTINGCHANGE: @@ -971,7 +971,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP { if (uMsg == WM_SETTINGCHANGE) // SPI_SETWORKAREA { - LSLog(LOG_NOTICE, APPNAME, L"System: Work area has been changed."); + Log(LOG_NOTICE, L"System: Work area has been changed."); UpdateWorkareaInfo(); CConfigParser::UpdateWorkareaVariables(); } diff --git a/Library/UpdateCheck.cpp b/Library/UpdateCheck.cpp index bbec8dca..898be917 100644 --- a/Library/UpdateCheck.cpp +++ b/Library/UpdateCheck.cpp @@ -33,7 +33,7 @@ void CheckVersion(void* dummy) 0); if (hRootHandle == NULL) { - LSLog(LOG_ERROR, APPNAME, L"CheckUpdate: InternetOpen failed."); + Log(LOG_ERROR, L"CheckUpdate: InternetOpen failed."); return; } @@ -75,18 +75,18 @@ void CheckVersion(void* dummy) else { Rainmeter->SetNewVersion(FALSE); - LSLog(LOG_NOTICE, APPNAME, L"CheckUpdate: No new version available."); + Log(LOG_NOTICE, L"CheckUpdate: No new version available."); } } else { - LSLog(LOG_ERROR, APPNAME, L"CheckUpdate: InternetReadFile failed."); + Log(LOG_ERROR, L"CheckUpdate: InternetReadFile failed."); } InternetCloseHandle(hUrlDump); } else { - LSLog(LOG_ERROR, APPNAME, L"CheckUpdate: InternetOpenUrl failed."); + Log(LOG_ERROR, L"CheckUpdate: InternetOpenUrl failed."); } InternetCloseHandle(hRootHandle);