summaryrefslogtreecommitdiff
path: root/library/error_log.h
diff options
context:
space:
mode:
Diffstat (limited to 'library/error_log.h')
-rw-r--r--library/error_log.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/library/error_log.h b/library/error_log.h
index d5696f80..ff4d3aee 100644
--- a/library/error_log.h
+++ b/library/error_log.h
@@ -9,37 +9,42 @@
#include <wx/string.h>
#include <vector>
+#include <map>
#include "../shared/zstring.h"
namespace ffs3
{
+enum MessageType
+{
+ TYPE_INFO = 1,
+ TYPE_WARNING = 2,
+ TYPE_ERROR = 4,
+ TYPE_FATAL_ERROR = 8,
+};
+
class ErrorLogging
{
public:
- ErrorLogging() : errorCount(0) {}
+ void logMsg(const wxString& message, MessageType type);
- void logInfo( const wxString& infoMessage);
- void logWarning( const wxString& warningMessage);
- void logError( const wxString& errorMessage);
- void logFatalError(const wxString& errorMessage);
+ int typeCount(int types = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const;
- int errorsTotal()
- {
- return errorCount;
- }
+ std::vector<wxString> getFormattedMessages(int types = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const;
- typedef std::vector<wxString> MessageEntry;
- const MessageEntry& getFormattedMessages() const
+private:
+ struct Entry
{
- return formattedMessages;
- }
+ MessageType type;
+ time_t time;
+ wxString message;
+ };
-private:
- wxString assembleMessage(const wxString& prefix, const wxString& message);
+ static wxString formatMessage(const Entry& msg);
+
+ std::vector<Entry> messages; //list of non-resolved errors and warnings
- MessageEntry formattedMessages; //list of non-resolved errors and warnings
- int errorCount;
+ mutable std::map<MessageType, int> statistics;
};
}
bgstack15