- Replace DebugLog() with LogWithArgs(int nLevel, const WCHAR* format, ... ), so that variable strings can be logged but the log level can be set to those other than LOG_DEBUG

- Note: DebugLog() is still in the code as I was not sure whether it is required to maintain Litestep interoperability
- Replaced instances of LOG_DEBUG where other log levels would be more appropriate
This commit is contained in:
JamesAC 2010-12-19 23:06:13 +00:00
parent 56d472d5b5
commit c50f1c27f2
27 changed files with 211 additions and 187 deletions

View File

@ -380,7 +380,7 @@ void ScanPlugins()
}
else
{
DebugLog(L"Unable to load library: \"%s\", ErrorCode=%u", tmpSz.c_str(), err);
LogWithArgs(LOG_WARNING, L"Unable to load library: \"%s\", ErrorCode=%u", tmpSz.c_str(), err);
}
g_Plugins.push_back(info);

View File

@ -750,7 +750,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_DEBUG, APPNAME, ConvertToWide(errMsg).c_str());
LSLog(LOG_ERROR, APPNAME, ConvertToWide(errMsg).c_str());
}
return resultValue;
@ -770,7 +770,7 @@ int CConfigParser::ReadFormula(const std::wstring& result, double* resultValue)
if (errMsg != NULL)
{
LSLog(LOG_DEBUG, APPNAME, ConvertToWide(errMsg).c_str());
LSLog(LOG_ERROR, APPNAME, ConvertToWide(errMsg).c_str());
return -1;
}
@ -1038,7 +1038,7 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
// Verify whether the file exists
if (_waccess(iniFile.c_str(), 0) == -1)
{
DebugLog(L"Unable to read file: %s", iniFile.c_str());
LogWithArgs(LOG_WARNING, L"Unable to read file: %s", iniFile.c_str());
return;
}
@ -1048,11 +1048,11 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
if (temporary)
{
if (CRainmeter::GetDebug()) DebugLog(L"Reading file: %s (Temp: %s)", iniFile.c_str(), iniRead.c_str());
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"Reading file: %s (Temp: %s)", iniFile.c_str(), iniRead.c_str());
}
else
{
if (CRainmeter::GetDebug()) DebugLog(L"Reading file: %s", iniFile.c_str());
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"Reading file: %s", iniFile.c_str());
iniRead = iniFile;
}

View File

@ -528,16 +528,16 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
switch(nLevel)
{
case 1:
case LOG_ERROR:
logInfo.type = L"ERROR";
break;
case 2:
case LOG_WARNING:
logInfo.type = L"WARNING";
break;
case 3:
case LOG_NOTICE:
logInfo.type = L"NOTICE";
break;
case 4:
case LOG_DEBUG:
logInfo.type = L"DEBUG";
break;
}
@ -605,6 +605,8 @@ 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, ... )
{
WCHAR buffer[4096];
@ -626,3 +628,26 @@ void DebugLog(const WCHAR* format, ... )
LSLog(LOG_DEBUG, L"Rainmeter", buffer);
va_end(args);
}
void LogWithArgs(int nLevel, const WCHAR* format, ... )
{
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)
{
nLevel = LOG_ERROR;
_snwprintf_s(buffer, _TRUNCATE, L"LogWithArgs() internal error: %s", format);
}
_set_invalid_parameter_handler(oldHandler);
LSLog(nLevel, L"Rainmeter", buffer);
va_end(args);
}

View File

@ -54,7 +54,8 @@ 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, ... );
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 ResetLoggingFlag();

View File

@ -156,7 +156,7 @@ void CMeasure::ReadConfig(CConfigParser& parser, const WCHAR* section)
}
if (!ParseSubstitute(subs))
{
DebugLog(L"Incorrect substitute string: %s", subs.c_str());
LogWithArgs(LOG_WARNING, L"Incorrect substitute string: %s", subs.c_str());
}
std::wstring group = parser.ReadString(section, L"Group", L"");
@ -697,5 +697,5 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow)
*/
void CMeasure::ExecuteBang(const WCHAR* args)
{
DebugLog(L"[%s] doesn't support this bang: %s", m_Name.c_str(), args);
LogWithArgs(LOG_WARNING, L"[%s] doesn't support this bang: %s", m_Name.c_str(), args);
}

View File

@ -101,7 +101,7 @@ void CMeasureCPU::ReadConfig(CConfigParser& parser, const WCHAR* section)
if (processor < 0 || processor > m_NumOfProcessors)
{
DebugLog(L"[%s] Invalid Processor: %i", section, processor);
LogWithArgs(LOG_WARNING, L"[%s] Invalid Processor: %i", section, processor);
processor = 0;
}

View File

@ -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_DEBUG, APPNAME, ConvertToWide(errMsg).c_str());
LSLog(LOG_ERROR, APPNAME, ConvertToWide(errMsg).c_str());
}
return PostUpdate();

View File

@ -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_DEBUG, APPNAME, L"Drive path is not given.");
LSLog(LOG_WARNING, APPNAME, L"Drive path is not given.");
m_Value = 0.0;
m_MaxValue = 0.0;
m_OldTotalBytes = 0;

View File

@ -114,7 +114,7 @@ void CMeasureNet::UpdateIFTable()
if (CRainmeter::GetDebug() && logging)
{
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
DebugLog(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
LogWithArgs(LOG_DEBUG, L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
for (size_t i = 0; i < c_NumOfTables; ++i)
{
@ -144,9 +144,9 @@ void CMeasureNet::UpdateIFTable()
break;
}
DebugLog(L"%i: %s", (int)i + 1, ifTable->Table[i].Description);
DebugLog(L" Alias: %s", ifTable->Table[i].Alias);
DebugLog(L" Type=%s(%i), Hardware=%s, Filter=%s",
LogWithArgs(LOG_DEBUG, L"%i: %s", (int)i + 1, ifTable->Table[i].Description);
LogWithArgs(LOG_DEBUG, L" Alias: %s", ifTable->Table[i].Alias);
LogWithArgs(LOG_DEBUG, L" Type=%s(%i), Hardware=%s, Filter=%s",
type.c_str(), ifTable->Table[i].Type,
(ifTable->Table[i].InterfaceAndOperStatusFlags.HardwareInterface == 1) ? L"Yes" : L"No",
(ifTable->Table[i].InterfaceAndOperStatusFlags.FilterInterface == 1) ? L"Yes" : L"No");
@ -210,7 +210,7 @@ void CMeasureNet::UpdateIFTable()
if (CRainmeter::GetDebug() && logging)
{
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
DebugLog(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
LogWithArgs(LOG_DEBUG, L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
for (size_t i = 0; i < c_NumOfTables; ++i)
{
@ -242,8 +242,8 @@ void CMeasureNet::UpdateIFTable()
break;
}
DebugLog(L"%i: %s", (int)i + 1, ConvertToWide(desc.c_str()).c_str());
DebugLog(L" Type=%s(%i)",
LogWithArgs(LOG_DEBUG, L"%i: %s", (int)i + 1, ConvertToWide(desc.c_str()).c_str());
LogWithArgs(LOG_DEBUG, L" Type=%s(%i)",
type.c_str(), ifTable->table[i].dwType);
}
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");

View File

@ -133,7 +133,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
if (CRainmeter::GetDebug())
{
DebugLog(L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", m_PluginName.c_str(), err);
LogWithArgs(LOG_ERROR, L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", m_PluginName.c_str(), err);
}
// Try to load from Rainmeter's folder
@ -149,7 +149,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
if (CRainmeter::GetDebug())
{
DebugLog(L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", pluginName.c_str(), err);
LogWithArgs(LOG_ERROR, L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", pluginName.c_str(), err);
}
}
}
@ -245,6 +245,6 @@ void CMeasurePlugin::ExecuteBang(const WCHAR* args)
}
else
{
DebugLog(L"[%s] doesn't support bangs.", m_Name.c_str());
LogWithArgs(LOG_WARNING, L"[%s] doesn't support bangs.", m_Name.c_str());
}
}

View File

@ -88,7 +88,7 @@ void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format,
wcsftime(buf, bufLen, m_Format.c_str(), time);
if (errno == EINVAL)
{
DebugLog(L"Time: Invalid Format: Measure=[%s], Format=\"%s\"", m_Name.c_str(), format);
LogWithArgs(LOG_WARNING, L"Time: Invalid Format: Measure=[%s], Format=\"%s\"", m_Name.c_str(), format);
buf[0] = 0;
}

View File

@ -98,7 +98,7 @@ const WCHAR* CMeasureUptime::GetStringValue(bool autoScale, double scale, int de
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
DebugLog(L"Uptime: Invalid Format: Measure=[%s], Format=\"%s\"", m_Name.c_str(), m_Format.c_str());
LogWithArgs(LOG_WARNING, L"Uptime: Invalid Format: Measure=[%s], Format=\"%s\"", m_Name.c_str(), m_Format.c_str());
buffer[0] = 0;
}

View File

@ -428,7 +428,7 @@ void CMeter::ReadConfig(const WCHAR* section)
}
else if (!matrix.empty())
{
DebugLog(L"The transformation matrix has incorrect number of values: %s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
LogWithArgs(LOG_WARNING, L"The transformation matrix has incorrect number of values: %s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
}
std::wstring group = parser.ReadString(section, L"Group", L"");

View File

@ -106,7 +106,7 @@ void CMeterHistogram::Initialize()
// A sanity check
if (m_SecondaryMeasure && !m_PrimaryImageName.empty() && (m_BothImageName.empty() || m_SecondaryImageName.empty()))
{
LSLog(LOG_DEBUG, APPNAME, L"You need to define SecondaryImage and BothImage also!");
LSLog(LOG_WARNING, APPNAME, L"You need to define SecondaryImage and BothImage also!");
m_PrimaryImage.DisposeImage();
m_SecondaryImage.DisposeImage();

View File

@ -161,8 +161,8 @@ void CMeterString::Initialize()
// It couldn't find the font family: Log it.
if(Ok != status)
{
std::wstring error = L"Error: Couldn't load font family: " + m_FontFace;
LSLog(LOG_DEBUG, APPNAME, error.c_str());
std::wstring error = L"Couldn't load font family: " + m_FontFace;
LSLog(LOG_ERROR, APPNAME, error.c_str());
delete m_FontFamily;
m_FontFamily = NULL;
@ -725,24 +725,22 @@ void CMeterString::EnumerateInstalledFontFamilies()
}
fonts += L", ";
}
LSLog(LOG_DEBUG, APPNAME, fonts.c_str());
LSLog(LOG_NOTICE, APPNAME, fonts.c_str());
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate installed font families: GetFamilies() failed.");
LSLog(LOG_ERROR, APPNAME, L"Failed to enumerate installed font families: GetFamilies() failed.");
}
delete [] fontFamilies;
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"There are no installed font families!");
LSLog(LOG_WARNING, APPNAME, L"There are no installed font families!");
}
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate installed font families: InstalledFontCollection() failed.");
LSLog(LOG_ERROR, APPNAME, L"Failed to enumerate installed font families: InstalledFontCollection() failed.");
}
}
// EOF
}

View File

@ -259,7 +259,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
}
}
LSLog(LOG_DEBUG, APPNAME, L"Initialization successful.");
LSLog(LOG_NOTICE, APPNAME, L"Initialization successful.");
return 0;
}
@ -303,11 +303,11 @@ void CMeterWindow::Refresh(bool init, bool all)
m_Rainmeter->SetCurrentParser(&m_Parser);
std::wstring dbg = L"Refreshing skin \"" + m_SkinName;
dbg += L"\\";
dbg += m_SkinIniFile;
dbg += L"\"";
LSLog(LOG_DEBUG, APPNAME, dbg.c_str());
std::wstring notice = L"Refreshing skin \"" + m_SkinName;
notice += L"\\";
notice += m_SkinIniFile;
notice += L"\"";
LSLog(LOG_NOTICE, APPNAME, notice.c_str());
m_Refreshing = true;
@ -759,7 +759,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterMove");
LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterMove");
}
break;
@ -855,7 +855,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
DebugLog(L"Unable to parse parameters for !RainmeterLsBoxHook (%s)", arg);
LogWithArgs(LOG_WARNING, L"Unable to parse parameters for !RainmeterLsBoxHook (%s)", arg);
}
}
break;
@ -871,12 +871,12 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse coordinates for !RainmeterMoveMeter");
LSLog(LOG_ERROR, APPNAME, L"Unable to parse coordinates for !RainmeterMoveMeter");
}
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterMoveMeter");
LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterMoveMeter");
}
break;
@ -919,11 +919,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
}
DebugLog(L"Unable to find [%s] for !RainmeterPluginBang", measure.c_str());
LogWithArgs(LOG_WARNING, L"Unable to find [%s] for !RainmeterPluginBang", measure.c_str());
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterPluginBang");
LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterPluginBang");
}
}
break;
@ -954,7 +954,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterSetVariable");
LSLog(LOG_ERROR, APPNAME, L"Unable to parse parameters for !RainmeterSetVariable");
}
break;
}
@ -987,7 +987,7 @@ void CMeterWindow::ShowMeter(const WCHAR* name, bool group)
if (!group) return;
}
if (!group) DebugLog(L"Unable to show the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to show the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
/*
@ -1017,7 +1017,7 @@ void CMeterWindow::HideMeter(const WCHAR* name, bool group)
if (!group) return;
}
if (!group) DebugLog(L"Unable to hide the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to hide the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
/*
@ -1054,7 +1054,7 @@ void CMeterWindow::ToggleMeter(const WCHAR* name, bool group)
if (!group) return;
}
if (!group) DebugLog(L"Unable to toggle the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to toggle the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
/*
@ -1079,7 +1079,7 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name)
}
}
DebugLog(L"Unable to move the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
LogWithArgs(LOG_NOTICE, L"Unable to move the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
/*
@ -1108,7 +1108,7 @@ void CMeterWindow::EnableMeasure(const WCHAR* name, bool group)
if (!group) return;
}
if (!group) DebugLog(L"Unable to enable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to enable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
@ -1138,7 +1138,7 @@ void CMeterWindow::DisableMeasure(const WCHAR* name, bool group)
if (!group) return;
}
if (!group) DebugLog(L"Unable to disable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to disable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
@ -1175,7 +1175,7 @@ void CMeterWindow::ToggleMeasure(const WCHAR* name, bool group)
if (!group) return;
}
if (!group) DebugLog(L"Unable to toggle the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to toggle the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
}
/* WindowToScreen
@ -1187,7 +1187,7 @@ void CMeterWindow::WindowToScreen()
{
if (CSystem::GetMonitorCount() == 0)
{
LSLog(LOG_DEBUG, APPNAME, L"There are no monitors. WindowToScreen function fails.");
LSLog(LOG_ERROR, APPNAME, L"There are no monitors. WindowToScreen function fails.");
return;
}
@ -1399,7 +1399,7 @@ void CMeterWindow::ScreenToWindow()
if (monitors.empty())
{
LSLog(LOG_DEBUG, APPNAME, L"There are no monitors. ScreenToWindow function fails.");
LSLog(LOG_ERROR, APPNAME, 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_DEBUG, APPNAME, message.c_str());
LSLog(LOG_WARNING, APPNAME, message.c_str());
MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false;
}
@ -1825,8 +1825,8 @@ bool CMeterWindow::ReadSkin()
nResults = m_FontCollection->AddFontFile(szFontFile.c_str());
if(nResults != Ok)
{
std::wstring error = L"Error: Couldn't load font file: " + localFont;
LSLog(LOG_DEBUG, APPNAME, error.c_str());
std::wstring error = L"Couldn't load font file: " + localFont;
LSLog(LOG_ERROR, APPNAME, error.c_str());
}
}
@ -1868,8 +1868,8 @@ bool CMeterWindow::ReadSkin()
// The font file wasn't found anywhere, log the error
if(nResults != Ok)
{
std::wstring error = L"Error: Couldn't load font file: " + localFont;
LSLog(LOG_DEBUG, APPNAME, error.c_str());
std::wstring error = L"Couldn't load font file: " + localFont;
LSLog(LOG_ERROR, APPNAME, error.c_str());
}
}
}
@ -4536,7 +4536,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
if (!found)
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to send the !bang to a deactivated config.");
LSLog(LOG_WARNING, APPNAME, L"Unable to send the !bang to a deactivated config.");
return 0; // This meterwindow has been deactivated
}

View File

@ -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_DEBUG, APPNAME, dbg.c_str());
LSLog(LOG_NOTICE, APPNAME, dbg.c_str());
}
}
else
@ -421,7 +421,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Incorrect number of arguments for the bang!");
LSLog(LOG_WARNING, APPNAME, 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_DEBUG, APPNAME, L"Incorrect number of arguments for the group bang!");
LSLog(LOG_WARNING, APPNAME, L"Incorrect number of arguments for the group bang!");
}
}
}
@ -1135,12 +1135,12 @@ void RainmeterActivateConfigWide(const WCHAR* arg)
}
}
}
DebugLog(L"No such config: \"%s\" \"%s\"", subStrings[0].c_str(), subStrings[1].c_str());
LogWithArgs(LOG_NOTICE, L"No such config: \"%s\" \"%s\"", subStrings[0].c_str(), subStrings[1].c_str());
}
else
{
// If we got this far, something went wrong
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterActivateConfig");
LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterActivateConfig");
}
}
}
@ -1165,11 +1165,11 @@ void RainmeterDeactivateConfigWide(const WCHAR* arg)
Rainmeter->DeactivateConfig(mw, -1);
return;
}
DebugLog(L"The config is not active: \"%s\"", subStrings[0].c_str());
LogWithArgs(LOG_NOTICE, L"The config is not active: \"%s\"", subStrings[0].c_str());
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfig");
LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfig");
}
}
}
@ -1200,7 +1200,7 @@ void RainmeterToggleConfigWide(const WCHAR* arg)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterToggleConfig");
LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterToggleConfig");
}
}
}
@ -1230,7 +1230,7 @@ void RainmeterDeactivateConfigGroupWide(const WCHAR* arg)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfigGroup");
LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfigGroup");
}
}
}
@ -1286,11 +1286,11 @@ void RainmeterSkinMenuWide(const WCHAR* arg)
Rainmeter->ShowContextMenu(pos, mw);
return;
}
DebugLog(L"The config is not active: \"%s\"", subStrings[0].c_str());
LogWithArgs(LOG_NOTICE, L"The config is not active: \"%s\"", subStrings[0].c_str());
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterSkinMenu");
LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterSkinMenu");
}
}
}
@ -1343,7 +1343,7 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
if (iniFile.find(L"..\\") != std::string::npos || iniFile.find(L"../") != std::string::npos)
{
DebugLog(L"!RainmeterWriteKeyValue: Illegal characters in path - \"..\\\": %s", iniFile.c_str());
LogWithArgs(LOG_ERROR, L"!RainmeterWriteKeyValue: Illegal characters in path - \"..\\\": %s", iniFile.c_str());
return;
}
@ -1353,14 +1353,14 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
if (_wcsnicmp(iniFile.c_str(), skinPath.c_str(), skinPath.size()) != 0 &&
_wcsnicmp(iniFile.c_str(), settingsPath.c_str(), settingsPath.size()) != 0)
{
DebugLog(L"!RainmeterWriteKeyValue: Illegal path outside of Rainmeter directories: %s", iniFile.c_str());
LogWithArgs(LOG_ERROR, L"!RainmeterWriteKeyValue: Illegal path outside of Rainmeter directories: %s", iniFile.c_str());
return;
}
// Verify whether the file exists
if (_waccess(iniFile.c_str(), 0) == -1)
{
DebugLog(L"!RainmeterWriteKeyValue: File not found: %s", iniFile.c_str());
LogWithArgs(LOG_WARNING, L"!RainmeterWriteKeyValue: File not found: %s", iniFile.c_str());
return;
}
@ -1368,7 +1368,7 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
DWORD attr = GetFileAttributes(iniFile.c_str());
if (attr == -1 || (attr & FILE_ATTRIBUTE_READONLY))
{
DebugLog(L"!RainmeterWriteKeyValue: File is read-only: %s", iniFile.c_str());
LogWithArgs(LOG_WARNING, L"!RainmeterWriteKeyValue: File is read-only: %s", iniFile.c_str());
return;
}
@ -1378,7 +1378,7 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
std::wstring iniWrite = CSystem::GetTemporaryFile(iniFileMappings, iniFile);
if (iniWrite == L"<>") // error occurred
{
DebugLog(L"!RainmeterWriteKeyValue: Failed to create a temporary file: %s", iniFile.c_str());
LogWithArgs(LOG_ERROR, L"!RainmeterWriteKeyValue: Failed to create a temporary file: %s", iniFile.c_str());
return;
}
@ -1386,11 +1386,11 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
if (temporary)
{
if (CRainmeter::GetDebug()) DebugLog(L"!RainmeterWriteKeyValue: Writing file: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"!RainmeterWriteKeyValue: Writing file: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
}
else
{
if (CRainmeter::GetDebug()) DebugLog(L"!RainmeterWriteKeyValue: Writing file: %s", iniFile.c_str());
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"!RainmeterWriteKeyValue: Writing file: %s", iniFile.c_str());
iniWrite = iniFile;
}
@ -1436,12 +1436,12 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
// Copy the file back
if (!CSystem::CopyFiles(iniWrite, iniFile))
{
DebugLog(L"!RainmeterWriteKeyValue: Failed to copy a temporary file to the original filepath: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
LogWithArgs(LOG_ERROR, L"!RainmeterWriteKeyValue: Failed to copy a temporary file to the original filepath: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
}
}
else // failed
{
DebugLog(L"!RainmeterWriteKeyValue: Failed to write a value to the file: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
LogWithArgs(LOG_ERROR, L"!RainmeterWriteKeyValue: Failed to write a value to the file: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
}
// Remove a temporary file
@ -1451,13 +1451,13 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
{
if (write == 0) // failed
{
DebugLog(L"!RainmeterWriteKeyValue: Failed to write a value to the file: %s", iniFile.c_str());
LogWithArgs(LOG_ERROR, L"!RainmeterWriteKeyValue: Failed to write a value to the file: %s", iniFile.c_str());
}
}
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterWriteKeyValue");
LSLog(LOG_WARNING, APPNAME, L"Unable to parse the arguments for !RainmeterWriteKeyValue");
}
}
}
@ -1730,7 +1730,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"Unable to get the My Documents location.");
LSLog(LOG_WARNING, APPNAME, L"Unable to get the My Documents location.");
}
}
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str());
@ -1765,10 +1765,10 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
}
}
DebugLog(L"Path: %s", m_Path.c_str());
DebugLog(L"IniFile: %s", m_IniFile.c_str());
DebugLog(L"SkinPath: %s", m_SkinPath.c_str());
DebugLog(L"PluginPath: %s", m_PluginPath.c_str());
LogWithArgs(LOG_NOTICE, L"Path: %s", m_Path.c_str());
LogWithArgs(LOG_NOTICE, L"IniFile: %s", m_IniFile.c_str());
LogWithArgs(LOG_NOTICE, L"SkinPath: %s", m_SkinPath.c_str());
LogWithArgs(LOG_NOTICE, L"PluginPath: %s", m_PluginPath.c_str());
// Extract volume path from program path
// E.g.:
@ -2143,7 +2143,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
{
if (((*iter).second)->GetSkinIniFile() == skinIniFile)
{
DebugLog(L"MeterWindow \"%s\" is already active.", skinConfig.c_str());
LogWithArgs(LOG_WARNING, L"MeterWindow \"%s\" is already active.", skinConfig.c_str());
return;
}
else
@ -2164,7 +2164,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
message += L"\\";
message += skinIniFile;
message += L"\": Ini-file not found.";
LSLog(LOG_DEBUG, APPNAME, message.c_str());
LSLog(LOG_WARNING, APPNAME, message.c_str());
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return;
}
@ -2965,7 +2965,7 @@ std::wstring CRainmeter::ParseCommand(const WCHAR* command, CMeterWindow* meterW
}
if (iter == meterWindow->GetMeasures().end())
{
DebugLog(L"No such measure [%s] for execute string: %s", measureName.c_str(), command);
LogWithArgs(LOG_WARNING, L"No such measure [%s] for execute string: %s", measureName.c_str(), command);
start = end + 1;
}
}
@ -3144,8 +3144,8 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
if (c_Debug)
{
DebugLog(L"ConfigEditor: %s", m_ConfigEditor.c_str());
DebugLog(L"LogViewer: %s", m_LogViewer.c_str());
LogWithArgs(LOG_NOTICE, L"ConfigEditor: %s", m_ConfigEditor.c_str());
LogWithArgs(LOG_NOTICE, L"LogViewer: %s", m_LogViewer.c_str());
}
m_TrayExecuteL = parser.ReadString(L"Rainmeter", L"TrayExecuteL", L"", false);
@ -3315,7 +3315,7 @@ void CRainmeter::RefreshAll()
message += L"\\";
message += skinIniFile;
message += L"\": Ini-file not found.";
LSLog(LOG_DEBUG, APPNAME, message.c_str());
LSLog(LOG_WARNING, APPNAME, 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_DEBUG, APPNAME, message.c_str());
LSLog(LOG_WARNING, APPNAME, message.c_str());
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}
continue;
@ -3375,7 +3375,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
{
format += L" => FAIL.";
}
DebugLog(format.c_str(), (int)i + 1, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
LogWithArgs(LOG_NOTICE, format.c_str(), (int)i + 1, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
}
}
changed = true;
@ -3397,7 +3397,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
if (c_Debug)
{
DebugLog(L"DesktopWorkAreaType: %s", m_DesktopWorkAreaType ? L"Margin" : L"Default");
LogWithArgs(LOG_NOTICE, L"DesktopWorkAreaType: %s", m_DesktopWorkAreaType ? L"Margin" : L"Default");
}
for (UINT i = 0; i <= CSystem::GetMonitorCount(); ++i)
@ -3449,7 +3449,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
{
format += L" => FAIL.";
}
DebugLog(format.c_str(), r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
LogWithArgs(LOG_NOTICE, format.c_str(), r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
}
}
}
@ -4122,7 +4122,7 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
}
if (!bSuccess)
{
LSLog(LOG_DEBUG, APPNAME, L"The Rainmeter.ini file is NOT writable.");
LSLog(LOG_WARNING, APPNAME, 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_DEBUG, APPNAME, L"The Rainmeter.ini file is writable.");
LSLog(LOG_NOTICE, APPNAME, L"The Rainmeter.ini file is writable.");
}
}
@ -4199,7 +4199,7 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
}
else
{
DebugLog(L"Unable to expand the environment strings for string: %s", strPath.c_str());
LogWithArgs(LOG_WARNING, L"Unable to expand the environment strings for string: %s", strPath.c_str());
}
}
}

View File

@ -172,12 +172,12 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
if (CRainmeter::GetDebug())
{
LSLog(LOG_DEBUG, APPNAME, info.szDevice);
DebugLog(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags);
DebugLog(L" Handle : 0x%p", hMonitor);
DebugLog(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
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)",
lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom,
lprcMonitor->right - lprcMonitor->left, lprcMonitor->bottom - lprcMonitor->top);
DebugLog(L" WorkArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
LogWithArgs(LOG_DEBUG, 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);
}
@ -346,7 +346,7 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(L" Name : %s", ddm.DeviceString);
LogWithArgs(LOG_DEBUG, L" Name : %s", ddm.DeviceString);
}
break;
}
@ -354,8 +354,8 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(L" Adapter : %s", dd.DeviceString);
DebugLog(L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags);
LogWithArgs(LOG_DEBUG, L" Adapter : %s", dd.DeviceString);
LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags);
}
if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE)
@ -372,7 +372,7 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(L" Handle : 0x%p", monitor.handle);
LogWithArgs(LOG_DEBUG, L" Handle : 0x%p", monitor.handle);
}
}
@ -387,10 +387,10 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
LogWithArgs(LOG_DEBUG, 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);
DebugLog(L" WorkArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
LogWithArgs(LOG_DEBUG, 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);
}
@ -417,8 +417,8 @@ void CSystem::SetMultiMonitorInfo()
{
if (logging)
{
DebugLog(L" Adapter : %s", dd.DeviceString);
DebugLog(L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags);
LogWithArgs(LOG_DEBUG, L" Adapter : %s", dd.DeviceString);
LogWithArgs(LOG_DEBUG, L" Flags : %s(0x%08X)", msg.c_str(), dd.StateFlags);
}
}
++dwDevice;
@ -427,7 +427,7 @@ void CSystem::SetMultiMonitorInfo()
if (monitors.empty()) // Failed to enumerate the non-mirroring monitors
{
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead.");
LSLog(LOG_WARNING, APPNAME, L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead.");
c_Monitors.useEnumDisplayDevices = false;
c_Monitors.useEnumDisplayMonitors = true;
}
@ -444,7 +444,7 @@ void CSystem::SetMultiMonitorInfo()
if (monitors.empty()) // Failed to enumerate the monitors
{
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate the monitors. Prepares the dummy monitor information.");
LSLog(LOG_WARNING, APPNAME, L"Failed to enumerate the monitors. Prepares the dummy monitor information.");
c_Monitors.useEnumDisplayMonitors = false;
MONITOR_INFO monitor = {0};
@ -487,9 +487,9 @@ void CSystem::SetMultiMonitorInfo()
}
LSLog(LOG_DEBUG, APPNAME, method.c_str());
DebugLog(L"* MONITORS: Count=%i, Primary=@%i", (int)monitors.size(), c_Monitors.primary);
LogWithArgs(LOG_DEBUG, L"* MONITORS: Count=%i, Primary=@%i", (int)monitors.size(), c_Monitors.primary);
LSLog(LOG_DEBUG, APPNAME, L"@0: Virtual screen");
DebugLog(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
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);
@ -497,14 +497,14 @@ void CSystem::SetMultiMonitorInfo()
{
if (monitors[i].active)
{
DebugLog(L"@%i: %s (active), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName);
DebugLog(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
LogWithArgs(LOG_DEBUG, L"@%i: %s (active), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName);
LogWithArgs(LOG_DEBUG, L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
monitors[i].screen.left, monitors[i].screen.top, monitors[i].screen.right, monitors[i].screen.bottom,
monitors[i].screen.right - monitors[i].screen.left, monitors[i].screen.bottom - monitors[i].screen.top);
}
else
{
DebugLog(L"@%i: %s (inactive), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName);
LogWithArgs(LOG_DEBUG, L"@%i: %s (inactive), MonitorName: %s", (int)i + 1, monitors[i].deviceName, monitors[i].monitorName);
}
}
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
@ -538,7 +538,7 @@ void CSystem::UpdateWorkareaInfo()
if (CRainmeter::GetDebug())
{
DebugLog(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
LogWithArgs(LOG_DEBUG, L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
(int)i + 1,
info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom,
info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
@ -684,7 +684,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
ZPOSITION zPos = Window->GetWindowZPosition();
if (zPos == ZPOSITION_ONDESKTOP || zPos == ZPOSITION_ONBOTTOM)
{
if (logging) DebugLog(L"+ [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
if (logging) LogWithArgs(LOG_DEBUG, L"+ [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
if (lParam)
{
@ -693,12 +693,12 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
}
else
{
if (logging) DebugLog(L"- [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
if (logging) LogWithArgs(LOG_DEBUG, L"- [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos);
}
}
else
{
if (logging) DebugLog(L" [%c] 0x%p : %s", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className);
if (logging) LogWithArgs(LOG_DEBUG, L" [%c] 0x%p : %s", IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className);
}
return TRUE;
@ -789,7 +789,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
{
if (logging)
{
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - %s",
LogWithArgs(LOG_DEBUG, L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - %s",
c_HelperWindow, WorkerW, hwnd, windowText, className, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
}
return;
@ -797,7 +797,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
if (logging)
{
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - FAILED",
LogWithArgs(LOG_DEBUG, L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=0x%p (\"%s\" %s) - FAILED",
c_HelperWindow, WorkerW, hwnd, windowText, className);
}
}
@ -805,7 +805,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
if (logging)
{
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_TOPMOST - %s",
LogWithArgs(LOG_DEBUG, L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_TOPMOST - %s",
c_HelperWindow, WorkerW, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
}
}
@ -816,7 +816,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
if (logging)
{
DebugLog(L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_BOTTOM - %s",
LogWithArgs(LOG_DEBUG, L"System: HelperWindow: hwnd=0x%p (WorkerW=0x%p), hwndInsertAfter=HWND_BOTTOM - %s",
c_HelperWindow, WorkerW, (GetWindowLong(c_HelperWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) ? L"TOPMOST" : L"NORMAL");
}
}
@ -843,7 +843,7 @@ void CSystem::CheckDesktopState(HWND WorkerW)
if (CRainmeter::GetDebug())
{
DebugLog(L"System: %s",
LogWithArgs(LOG_DEBUG, L"System: %s",
c_ShowDesktop ? L"\"Show the desktop\" has been detected." : L"\"Show open windows\" has been detected.");
}
@ -944,7 +944,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
break;
case WM_DWMCOMPOSITIONCHANGED:
LSLog(LOG_DEBUG, APPNAME, L"System: DWM desktop composition has been changed.");
LSLog(LOG_NOTICE, APPNAME, 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_DEBUG, APPNAME, L"System: Display setting has been changed.");
LSLog(LOG_NOTICE, APPNAME, 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_DEBUG, APPNAME, L"System: Work area has been changed.");
LSLog(LOG_NOTICE, APPNAME, L"System: Work area has been changed.");
UpdateWorkareaInfo();
CConfigParser::UpdateWorkareaVariables();
}
@ -1195,7 +1195,7 @@ bool CSystem::CopyFiles(const std::wstring& strFrom, const std::wstring& strTo,
int result = SHFileOperation(&fo);
if (result != 0)
{
DebugLog(L"Unable to copy files from %s to %s (%i)", strFrom.c_str(), strTo.c_str(), result);
LogWithArgs(LOG_ERROR, L"Unable to copy files from %s to %s (%i)", strFrom.c_str(), strTo.c_str(), result);
return false;
}
return true;
@ -1302,7 +1302,7 @@ std::wstring CSystem::GetTemporaryFile(const std::vector<std::wstring>& iniFileM
}
else // failed
{
DebugLog(L"Unable to create a temporary file to: %s", temporary.c_str());
LogWithArgs(LOG_ERROR, L"Unable to create a temporary file to: %s", temporary.c_str());
return L"<>";
}
}

View File

@ -198,25 +198,25 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
if (!m_Bitmap)
{
DebugLog(L"Unable to create %s: %s", m_ConfigName.c_str(), filename.c_str());
LogWithArgs(LOG_ERROR, L"Unable to create %s: %s", m_ConfigName.c_str(), filename.c_str());
DisposeImage();
}
}
else
{
DebugLog(L"Unable to allocate memory ( %i bytes ) for %s: %s", imageSize, m_ConfigName.c_str(), filename.c_str());
LogWithArgs(LOG_ERROR, L"Unable to allocate memory ( %i bytes ) for %s: %s", imageSize, m_ConfigName.c_str(), filename.c_str());
}
}
else
{
DebugLog(L"Unable to get %s's file size: %s", m_ConfigName.c_str(), filename.c_str());
LogWithArgs(LOG_ERROR, L"Unable to get %s's file size: %s", m_ConfigName.c_str(), filename.c_str());
}
}
CloseHandle(fileHandle);
}
else
{
DebugLog(L"Unable to load %s: %s", m_ConfigName.c_str(), filename.c_str());
LogWithArgs(LOG_ERROR, L"Unable to load %s: %s", m_ConfigName.c_str(), filename.c_str());
DisposeImage();
}

View File

@ -355,7 +355,7 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
Status status = m_Bitmap->GetLastStatus();
if(Ok != status)
{
DebugLog(L"Bitmap image not found: %s", imageName.c_str());
LogWithArgs(LOG_WARNING, L"Bitmap image not found: %s", imageName.c_str());
delete m_Bitmap;
m_Bitmap = NULL;
}
@ -364,7 +364,7 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
}
else
{
DebugLog(L"No such TrayMeter: %s", type.c_str());
LogWithArgs(LOG_ERROR, L"No such TrayMeter: %s", type.c_str());
}
int trayIcon = parser.ReadInt(L"Rainmeter", L"TrayIcon", 1);

View File

@ -33,7 +33,7 @@ void CheckVersion(void* dummy)
0);
if (hRootHandle == NULL)
{
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: InternetOpen failed.");
LSLog(LOG_ERROR, APPNAME, L"CheckUpdate: InternetOpen failed.");
return;
}
@ -75,18 +75,18 @@ void CheckVersion(void* dummy)
else
{
Rainmeter->SetNewVersion(FALSE);
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: No new version available.");
LSLog(LOG_NOTICE, APPNAME, L"CheckUpdate: No new version available.");
}
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: InternetReadFile failed.");
LSLog(LOG_ERROR, APPNAME, L"CheckUpdate: InternetReadFile failed.");
}
InternetCloseHandle(hUrlDump);
}
else
{
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: InternetOpenUrl failed.");
LSLog(LOG_ERROR, APPNAME, L"CheckUpdate: InternetOpenUrl failed.");
}
InternetCloseHandle(hRootHandle);

View File

@ -139,7 +139,7 @@ double Update2(UINT id)
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"PerfMon plugin works only in Win2K and later.");
LSLog(LOG_NOTICE, L"Rainmeter", L"PerfMon plugin works only in Win2K and later.");
}
}
}

View File

@ -155,14 +155,14 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to get the host by name.");
LSLog(LOG_WARNING, L"Rainmeter", L"Unable to get the host by name.");
}
WSACleanup();
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to initialize Windows Sockets.");
LSLog(LOG_WARNING, L"Rainmeter", L"Unable to initialize Windows Sockets.");
}
}
valid = true;
@ -290,7 +290,7 @@ void Finalize(HMODULE instance, UINT id)
if ((*i1).second->threadHandle)
{
// Should really wait until the thread finishes instead terminating it...
LSLog(LOG_DEBUG, L"Rainmeter", L"PingPlugin: Thread still running -> Terminate.");
LSLog(LOG_NOTICE, L"Rainmeter", L"PingPlugin: Thread still running -> Terminate.");
TerminateThread((*i1).second->threadHandle, 0);
}
LeaveCriticalSection(&g_CriticalSection);

View File

@ -268,7 +268,7 @@ bool ReadSharedData(SensorType type, TempScale scale, UINT number, double* value
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"SpeedFanPlugin: The shared memory has incorrect version.");
LSLog(LOG_WARNING, L"Rainmeter", L"SpeedFanPlugin: The shared memory has incorrect version.");
}
UnmapViewOfFile(ptr);

View File

@ -85,7 +85,7 @@ bool InitCom()
if (!com_initialized) com_initialized = SUCCEEDED(CoInitialize(0));
if (!com_initialized)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: COM initialization failed!");
LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: COM initialization failed!");
return false;
}
HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, 0, CLSCTX_ALL,
@ -104,12 +104,12 @@ bool InitCom()
dbg_str += e_code;
}
LSLog(LOG_DEBUG, L"Rainmeter", dbg_str.c_str());
LSLog(LOG_ERROR, L"Rainmeter", dbg_str.c_str());
return CleanUp() != 0;
}
if (S_OK != pEnumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &pCollection) || !pCollection)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Could not enumerate AudioEndpoints!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Could not enumerate AudioEndpoints!");
return CleanUp() != 0;
}
return true;
@ -145,7 +145,7 @@ HRESULT RegisterDevice(PCWSTR devID)
}
catch (...)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: RegisterDevice - Exception!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: RegisterDevice - Exception!");
hr = S_FALSE;
}
UnInitCom();
@ -170,7 +170,7 @@ std::wstring GetDefaultID()
}
catch (...)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: GetDefaultID - Exception!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: GetDefaultID - Exception!");
id_default = L"Exception";
}
SAFE_RELEASE(pEndpoint)
@ -207,7 +207,7 @@ bool GetWin7AudioState(const VolumeAction action)
}
catch (...)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Win7ToggleMute - Exception!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Win7ToggleMute - Exception!");
}
SAFE_RELEASE(pEndptVol)
SAFE_RELEASE(pEndpoint)
@ -266,7 +266,7 @@ bool SetWin7Volume(UINT volume, int offset = 0)
}
catch (...)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: SetWin7Volume - Exception!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: SetWin7Volume - Exception!");
}
SAFE_RELEASE(pEndptVol)
SAFE_RELEASE(pEndpoint)
@ -396,7 +396,7 @@ LPCTSTR GetString(UINT id, UINT flags)
wsprintf(result, L"ERROR - Getting Default Device");
}
} catch (...) {
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: GetString - Exception!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: GetString - Exception!");
wsprintf(result, L"Exception");
}
UnInitCom();
@ -441,7 +441,7 @@ void ExecuteBang(LPCTSTR args, UINT id)
{
if (endpointIDs.size() <= 0)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: No device found!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: No device found!");
return;
}
// set to endpoint [index-1]
@ -451,7 +451,7 @@ void ExecuteBang(LPCTSTR args, UINT id)
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Incorrect number of arguments for the bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Incorrect number of arguments for the bang!");
}
}
else if (_wcsicmp(bang.c_str(), L"SetVolume") == 0)
@ -462,12 +462,12 @@ void ExecuteBang(LPCTSTR args, UINT id)
{
if (!SetWin7Volume(volume < 0 ? 0 : (volume > 100 ? 100 : (UINT)volume)))
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Error setting volume!");
LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Error setting volume!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Incorrect number of arguments for the bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Incorrect number of arguments for the bang!");
}
}
else if (_wcsicmp(bang.c_str(), L"ChangeVolume") == 0)
@ -478,17 +478,17 @@ void ExecuteBang(LPCTSTR args, UINT id)
{
if (!SetWin7Volume(0, offset))
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Error changing volume!");
LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Error changing volume!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Incorrect number of arguments for the bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Incorrect number of arguments for the bang!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Unknown bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Unknown bang!");
}
}
@ -497,17 +497,17 @@ void ExecuteBang(LPCTSTR args, UINT id)
//LSLog(LOG_NOTICE, L"Rainmeter", L"Win7AudioPlugin: Next device.");
const UINT i = GetIndex();
if (i) RegisterDevice(endpointIDs[(i == endpointIDs.size()) ? 0 : i].c_str());
else LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Update error - Try refresh!");
else LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Update error - Try refresh!");
}
else if (_wcsicmp(wholeBang.c_str(), L"TogglePrevious") == 0)
{
const UINT i = GetIndex();
if (i) RegisterDevice(endpointIDs[(i == 1) ? endpointIDs.size() - 1 : i - 2].c_str());
else LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Update error - Try refresh!");
else LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Update error - Try refresh!");
}
else if (_wcsicmp(wholeBang.c_str(), L"ToggleMute") == 0)
{
if (!GetWin7AudioState(TOGGLE_MUTE)) LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Mute Toggle Error!");
if (!GetWin7AudioState(TOGGLE_MUTE)) LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Mute Toggle Error!");
}
else if (_wcsicmp(wholeBang.c_str(), L"Mute") == 0)
{
@ -515,7 +515,7 @@ void ExecuteBang(LPCTSTR args, UINT id)
{
if (!GetWin7AudioState(TOGGLE_MUTE))
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Mute Error!");
LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Mute Error!");
}
}
}
@ -525,12 +525,12 @@ void ExecuteBang(LPCTSTR args, UINT id)
{
if (!GetWin7AudioState(TOGGLE_MUTE))
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Unmute Error!");
LSLog(LOG_ERROR, L"Rainmeter", L"Win7AudioPlugin: Unmute Error!");
}
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Win7AudioPlugin: Unknown bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"Win7AudioPlugin: Unknown bang!");
}
}

View File

@ -208,26 +208,26 @@ void ExecuteBang(LPCTSTR args, UINT id)
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"WindowMessagePlugin: Unable to find the window!");
LSLog(LOG_ERROR, L"Rainmeter", L"WindowMessagePlugin: Unable to find the window!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"WindowMessagePlugin: Unable to find the window data!");
LSLog(LOG_ERROR, L"Rainmeter", L"WindowMessagePlugin: Unable to find the window data!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"WindowMessagePlugin: Incorrect number of arguments for the bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"WindowMessagePlugin: Incorrect number of arguments for the bang!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"WindowMessagePlugin: Unknown bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"WindowMessagePlugin: Unknown bang!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"WindowMessagePlugin: Unable to parse the bang!");
LSLog(LOG_WARNING, L"Rainmeter", L"WindowMessagePlugin: Unable to parse the bang!");
}
}

View File

@ -456,17 +456,17 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
{
InstanceCreated = true;
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: iTunesApp initialized successfully.");
LSLog(LOG_NOTICE, L"Rainmeter", L"iTunesPlugin: iTunesApp initialized successfully.");
initEventHandler();
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Unable to create the iTunesApp instance.");
LSLog(LOG_WARNING, L"Rainmeter", L"iTunesPlugin: Unable to create the iTunesApp instance.");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Unable to find the iTunes window.");
LSLog(LOG_WARNING, L"Rainmeter", L"iTunesPlugin: Unable to find the iTunes window.");
}
const wchar_t* type = ReadConfigString(section, L"Command", L"");
@ -501,12 +501,12 @@ UINT Update(UINT id)
if (!iTunesAboutToPromptUserToQuit && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
{
InstanceCreated = true;
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: iTunesApp initialized successfully.");
LSLog(LOG_NOTICE, L"Rainmeter", L"iTunesPlugin: iTunesApp initialized successfully.");
initEventHandler();
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Unable to create the iTunesApp instance.");
LSLog(LOG_WARNING, L"Rainmeter", L"iTunesPlugin: Unable to create the iTunesApp instance.");
return 0;
}
}
@ -776,7 +776,7 @@ void ExecuteBang(LPCTSTR args, UINT id)
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Invalid command.");
LSLog(LOG_NOTICE, L"Rainmeter", L"iTunesPlugin: Invalid command.");
return;
}
}