diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
commit | d2854834e18443876c8f75e0a7f3b88d1d549fc4 (patch) | |
tree | e967b628081e50abc7c34cd264e6586271c7e728 /lib/error_log.cpp | |
parent | 4.1 (diff) | |
download | FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.gz FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.bz2 FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.zip |
4.2
Diffstat (limited to 'lib/error_log.cpp')
-rw-r--r-- | lib/error_log.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/error_log.cpp b/lib/error_log.cpp index fe423479..67584dea 100644 --- a/lib/error_log.cpp +++ b/lib/error_log.cpp @@ -5,7 +5,7 @@ // ************************************************************************** #include "error_log.h" -#include <wx/datetime.h> +#include <zen/time.h> #include <zen/i18n.h> #include <algorithm> @@ -16,7 +16,7 @@ void ErrorLogging::logMsg(const wxString& message, zen::MessageType type) { Entry newEntry; newEntry.type = type; - newEntry.time = wxDateTime::GetTimeNow(); + newEntry.time = std::time(NULL); newEntry.message = message; messages.push_back(newEntry); @@ -76,11 +76,11 @@ wxString ErrorLogging::formatMessage(const Entry& msg) break; } - const wxString prefix = wxString(L"[") + wxDateTime(msg.time).FormatTime() + L"] " + typeName + L": "; + const wxString prefix = L"[" + formatTime<wxString>(FORMAT_TIME, localTime(msg.time)) + L"] " + typeName + L": "; wxString formattedText = prefix; - for (auto i = msg.message.begin(); i != msg.message.end(); ++i) - if (*i == wxChar('\n')) + for (auto iter = msg.message.begin(); iter != msg.message.end(); ) + if (*iter == L'\n') { formattedText += L'\n'; @@ -88,12 +88,14 @@ wxString ErrorLogging::formatMessage(const Entry& msg) blanks.resize(prefix.size(), L' '); formattedText += blanks; - while (*++i == L'\n') //remove duplicate newlines - ; - --i; + do //remove duplicate newlines + { + ++iter; + } + while (iter != msg.message.end() && *iter == L'\n'); } else - formattedText += *i; + formattedText += *iter++; return formattedText; } |