mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-26 05:42:24 +08:00
patch by jerry -- his first patch! :-)
issue #421 -- portable version for windows.
This commit is contained in:
@@ -115,6 +115,9 @@ CLog::getFilterName() const
|
||||
const char*
|
||||
CLog::getFilterName(int level) const
|
||||
{
|
||||
if (level < 0) {
|
||||
return "Message";
|
||||
}
|
||||
return g_priority[level];
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user