patch by jerry -- his first patch! :-)

issue #421 -- portable version for windows.
This commit is contained in:
Nick Bolton
2013-03-15 16:14:43 +00:00
parent c8ea071d78
commit 6ec2ea2c0e
27 changed files with 1352 additions and 15 deletions

View File

@@ -115,6 +115,9 @@ CLog::getFilterName() const
const char*
CLog::getFilterName(int level) const
{
if (level < 0) {
return "Message";
}
return g_priority[level];
}

View File

@@ -263,3 +263,47 @@ CFileLogOutputter::close() {}
void
CFileLogOutputter::show(bool showIfEmpty) {}
//
// CMesssageBoxLogOutputter
//
CMesssageBoxLogOutputter::CMesssageBoxLogOutputter()
{
// do nothing
}
CMesssageBoxLogOutputter::~CMesssageBoxLogOutputter()
{
// do nothing
}
void
CMesssageBoxLogOutputter::open(const char* title)
{
// do nothing
}
void
CMesssageBoxLogOutputter::close()
{
// do nothing
}
void
CMesssageBoxLogOutputter::show(bool showIfEmpty)
{
// do nothing
}
bool
CMesssageBoxLogOutputter::write(ELevel level, const char* msg)
{
// don't spam user with messages.
if (level > kERROR) {
return true;
}
MessageBox(NULL, msg, CLOG->getFilterName(level), MB_OK);
return true;
}

View File

@@ -153,4 +153,20 @@ private:
CBuffer m_buffer;
};
//! Write log to message box
/*!
The level for each message is ignored.
*/
class CMesssageBoxLogOutputter : public ILogOutputter {
public:
CMesssageBoxLogOutputter();
virtual ~CMesssageBoxLogOutputter();
// ILogOutputter overrides
virtual void open(const char* title);
virtual void close();
virtual void show(bool showIfEmpty);
virtual bool write(ELevel level, const char* message);
};
#endif