Made log messages more consistent.

This commit is contained in:
Birunthan Mohanathas 2011-11-09 09:27:06 +00:00
parent f8f31a527e
commit 1e9d424c99
16 changed files with 55 additions and 60 deletions

View File

@ -744,9 +744,9 @@ double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue)
error += ConvertToWide(errMsg);
error += L" in key \"";
error += key ? key : L"";
error += L"\" in section [";
error += L"\" in [";
error += section ? section : L"";
error += L"].";
error += L"]";
Log(LOG_ERROR, error.c_str());
}

View File

@ -25,17 +25,13 @@
class CError
{
public:
CError(const std::wstring& String) : m_String(String), m_File(NULL) {}
CError(const WCHAR* String ) : m_String(String), m_File(NULL) {}
CError(const std::wstring& String, int Line, const char* File) : m_String(String), m_Line(Line), m_File(File) {}
CError(const WCHAR* String, int Line, const char* File) : m_String(String), m_Line(Line), m_File(File) {}
CError(const std::wstring& String) : m_String(String) {}
CError(const WCHAR* String ) : m_String(String) {}
const std::wstring& GetString();
private:
std::wstring m_String;
int m_Line;
const char* m_File;
};
#endif

View File

@ -836,7 +836,7 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons
error += L" is not valid in [";
error += name;
error += L"]";
throw CError(error, __LINE__, __FILE__);
throw CError(error);
return NULL;
}

View File

@ -84,9 +84,9 @@ bool CMeasureCalc::Update()
{
std::wstring error = L"Calc: ";
error += ConvertToWide(errMsg);
error += L" in measure [";
error += L" in [";
error += m_Name;
error += L"].";
error += L"]";
Log(LOG_ERROR, error.c_str());
}

View File

@ -151,7 +151,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
std::wstring error = L"Plugin: \"" + m_PluginName;
error += L"\" not found";
throw CError(error, __LINE__, __FILE__);
throw CError(error);
}
}
@ -167,8 +167,8 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
FreeLibrary(m_Plugin);
std::wstring error = L"Plugin: \"" + m_PluginName;
error += L"\" doesn't export Update() or GetString()!";
throw CError(error, __LINE__, __FILE__);
error += L"\" doesn't export Update() or GetString()";
throw CError(error);
}
// Initialize the plugin

View File

@ -154,7 +154,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
error += L" is not valid in [";
error += m_Name;
error += L"]";
throw CError(error, __LINE__, __FILE__);
throw CError(error);
}
m_RegKeyName = parser.ReadString(section, L"RegKey", L"");

View File

@ -462,8 +462,8 @@ void CMeter::BindMeasure(const std::list<CMeasure*>& measures)
if (m_MeasureName.empty())
{
std::wstring error = L"The meter [" + m_Name;
error += L"] is unbound!";
throw CError(error, __LINE__, __FILE__);
error += L"] is unbound";
throw CError(error);
}
// Go through the list and check it there is a measure for us
@ -481,8 +481,8 @@ void CMeter::BindMeasure(const std::list<CMeasure*>& measures)
std::wstring error = L"The meter [" + m_Name;
error += L"] cannot be bound with [";
error += m_MeasureName;
error += L"]!";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
/*
@ -534,10 +534,10 @@ CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHA
// Error
std::wstring error = L"Meter=";
error += meter;
error += L" is not valid in section [";
error += L" is not valid in [";
error += name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
return NULL;
}

View File

@ -131,10 +131,10 @@ void CMeterBar::ReadConfig(CConfigParser& parser, const WCHAR* section)
else
{
std::wstring error = L"BarOrientation=" + orientation;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += m_Name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
if (m_Initialized)

View File

@ -212,10 +212,10 @@ void CMeterBitmap::ReadConfig(CConfigParser& parser, const WCHAR* section)
else
{
std::wstring error = L"BitmapAlign=" + align;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += m_Name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
if (m_Initialized)

View File

@ -529,7 +529,7 @@ void CMeterHistogram::BindMeasure(const std::list<CMeasure*>& measures)
std::wstring error = L"The meter [" + m_Name;
error += L"] cannot be bound with [";
error += m_SecondaryMeasureName;
error += L"]!";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
}

View File

@ -388,8 +388,8 @@ void CMeterImage::BindMeasure(const std::list<CMeasure*>& measures)
std::wstring error = L"The meter [" + m_Name;
error += L"] cannot be bound with [";
error += (*j);
error += L"]!";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
}
CMeter::SetAllMeasures(m_Measures);

View File

@ -377,8 +377,8 @@ void CMeterLine::BindMeasure(const std::list<CMeasure*>& measures)
std::wstring error = L"The meter [" + m_Name;
error += L"] cannot be bound with [";
error += (*j);
error += L"]!";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
}
CMeter::SetAllMeasures(m_Measures);

View File

@ -279,7 +279,7 @@ void CMeterString::Initialize()
if (m_FontSize != 0)
{
std::wstring error = L"String: Unable to create font: " + m_FontFace;
throw CError(error, __LINE__, __FILE__);
throw CError(error);
}
}
}
@ -378,10 +378,10 @@ void CMeterString::ReadConfig(CConfigParser& parser, const WCHAR* section)
else
{
std::wstring error = L"StringAlign=" + align;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += m_Name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
const std::wstring& stringCase = parser.ReadString(section, L"StringCase", L"NONE");
@ -404,10 +404,10 @@ void CMeterString::ReadConfig(CConfigParser& parser, const WCHAR* section)
else
{
std::wstring error = L"StringCase=" + stringCase;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += m_Name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
const std::wstring& style = parser.ReadString(section, L"StringStyle", L"NORMAL");
@ -430,10 +430,10 @@ void CMeterString::ReadConfig(CConfigParser& parser, const WCHAR* section)
else
{
std::wstring error = L"StringStyle=" + style;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += m_Name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
const std::wstring& effect = parser.ReadString(section, L"StringEffect", L"NONE");
@ -452,10 +452,10 @@ void CMeterString::ReadConfig(CConfigParser& parser, const WCHAR* section)
else
{
std::wstring error = L"StringEffect=" + effect;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += m_Name;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
if (m_Initialized &&
@ -697,8 +697,8 @@ void CMeterString::BindMeasure(const std::list<CMeasure*>& measures)
std::wstring error = L"The meter [" + m_Name;
error += L"] cannot be bound with [";
error += (*j);
error += L"]!";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
}
CMeter::SetAllMeasures(m_Measures);

View File

@ -255,7 +255,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
if (err != 0 && ERROR_CLASS_ALREADY_EXISTS != err)
{
throw CError(L"Unable to register class!", __LINE__, __FILE__);
throw CError(L"Unable to register class");
}
}
@ -274,7 +274,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
if (m_Window == NULL)
{
throw CError(L"Unable to register window!", __LINE__, __FILE__);
throw CError(L"Unable to register window");
}
setlocale(LC_NUMERIC, "C");
@ -441,13 +441,13 @@ void CMeterWindow::Refresh(bool init, bool all)
{
if (0 == SetTimer(m_Window, TIMER_METER, m_WindowUpdate, NULL))
{
throw CError(L"Unable to set timer!", __LINE__, __FILE__);
throw CError(L"Unable to set timer");
}
}
if (0 == SetTimer(m_Window, TIMER_MOUSE, INTERVAL_MOUSE, NULL)) // Mouse position is checked twice per sec
{
throw CError(L"Unable to set timer!", __LINE__, __FILE__);
throw CError(L"Unable to set timer");
}
m_Rainmeter->SetCurrentParser(NULL);

View File

@ -626,10 +626,10 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
std::wstring error = m_ConfigArray[ConfigIndexImageCrop];
error += L"=";
error += crop;
error += L" (origin) is not valid in meter [";
error += L" (origin) is not valid in [";
error += section;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
}
}
@ -734,10 +734,10 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
std::wstring error = m_ConfigArray[ConfigIndexImageFlip];
error += L"=";
error += flip;
error += L" is not valid in meter [";
error += L" is not valid in [";
error += section;
error += L"].";
throw CError(error, __LINE__, __FILE__);
error += L"]";
throw CError(error);
}
if (!m_DisableTransform)

View File

@ -100,7 +100,6 @@ static int MeterWindow_GetMeter(lua_State* L)
{
std::wstring error = L"Script: No such meter as ";
error += meterName;
error += L".";
Log(LOG_ERROR, error.c_str());
return 0;
}