mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added !Log bang to write to the Rainmeter log
This commit is contained in:
parent
1ae296c3a2
commit
da8b11351d
@ -635,6 +635,44 @@ void CRainmeter::Bang_WriteKeyValue(const WCHAR* arg, CMeterWindow* meterWindow)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** !Log bang
|
||||
**
|
||||
*/
|
||||
void CRainmeter::Bang_Log(const WCHAR* arg)
|
||||
{
|
||||
std::vector<std::wstring> subStrings = ParseString(arg);
|
||||
|
||||
if (!subStrings.empty())
|
||||
{
|
||||
int level = LOG_NOTICE;
|
||||
|
||||
if (subStrings.size() > 1)
|
||||
{
|
||||
const WCHAR* type = subStrings[1].c_str();
|
||||
if (_wcsicmp(type, L"ERROR") == 0)
|
||||
{
|
||||
level = LOG_ERROR;
|
||||
}
|
||||
else if (_wcsicmp(type, L"WARNING") == 0)
|
||||
{
|
||||
level = LOG_WARNING;
|
||||
}
|
||||
else if (_wcsicmp(type, L"DEBUG") == 0)
|
||||
{
|
||||
level = LOG_DEBUG;
|
||||
}
|
||||
else if (_wcsicmp(type, L"NOTICE") != 0)
|
||||
{
|
||||
Log(LOG_ERROR, L"!Log: Invalid type");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log(level, subStrings[0].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------
|
||||
//
|
||||
@ -1935,6 +1973,10 @@ void CRainmeter::ExecuteBang(const std::wstring& name, std::wstring& arg, CMeter
|
||||
{
|
||||
ResetStats();
|
||||
}
|
||||
else if (_wcsicmp(bang, L"Log") == 0)
|
||||
{
|
||||
Bang_Log(args);
|
||||
}
|
||||
else if (_wcsicmp(bang, L"Quit") == 0)
|
||||
{
|
||||
// Quit needs to be delayed since it crashes if done during Update()
|
||||
|
@ -245,6 +245,7 @@ private:
|
||||
void Bang_SkinMenu(const WCHAR* arg, CMeterWindow* meterWindow);
|
||||
void Bang_TrayMenu();
|
||||
void Bang_WriteKeyValue(const WCHAR* arg, CMeterWindow* meterWindow);
|
||||
void Bang_Log(const WCHAR* arg);
|
||||
|
||||
void ExecuteBang(const std::wstring& name, std::wstring& arg, CMeterWindow* meterWindow);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user