diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:10:11 +0200 |
commit | c0cdb2ad99a1e2a6ade5ce76c91177a79258e669 (patch) | |
tree | 4701a015385d9a6a5a4ba99a8f1f5d400fff26b1 /library/error_log.h | |
parent | 3.13 (diff) | |
download | FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.gz FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.bz2 FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.zip |
3.14
Diffstat (limited to 'library/error_log.h')
-rw-r--r-- | library/error_log.h | 39 |
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; }; } |