From bd6336c629841c6db3a6ca53a936d629d34db53b Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:15:16 +0200 Subject: 4.1 --- lib/error_log.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/error_log.h (limited to 'lib/error_log.h') diff --git a/lib/error_log.h b/lib/error_log.h new file mode 100644 index 00000000..a0b7ab90 --- /dev/null +++ b/lib/error_log.h @@ -0,0 +1,49 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef ERRORLOGGING_H_INCLUDED +#define ERRORLOGGING_H_INCLUDED + +#include +#include +#include + +namespace zen +{ +enum MessageType +{ + TYPE_INFO = 1, + TYPE_WARNING = 2, + TYPE_ERROR = 4, + TYPE_FATAL_ERROR = 8, +}; + +class ErrorLogging +{ +public: + void logMsg(const wxString& message, MessageType type); + + int typeCount(int typeFilter = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; + + std::vector getFormattedMessages(int typeFilter = TYPE_INFO | TYPE_WARNING | TYPE_ERROR | TYPE_FATAL_ERROR) const; + +private: + struct Entry + { + MessageType type; + time_t time; + wxString message; + }; + + static wxString formatMessage(const Entry& msg); + + std::vector messages; //list of non-resolved errors and warnings + + mutable std::map statistics; +}; +} + +#endif // ERRORLOGGING_H_INCLUDED -- cgit