summaryrefslogtreecommitdiff
path: root/zen/error_log.h
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-05-22 21:09:26 +0000
committerB. Stack <bgstack15@gmail.com>2022-05-22 21:09:26 +0000
commit54c2e44d7b37b2c3efc449e054eef21fa414dfde (patch)
tree3894ba7e10c78750c195381a861da5e8166a6bfd /zen/error_log.h
parentMerge branch 'b11.20' into 'master' (diff)
parentadd upstream 11.21 (diff)
downloadFreeFileSync-54c2e44d7b37b2c3efc449e054eef21fa414dfde.tar.gz
FreeFileSync-54c2e44d7b37b2c3efc449e054eef21fa414dfde.tar.bz2
FreeFileSync-54c2e44d7b37b2c3efc449e054eef21fa414dfde.zip
Merge branch 'b11.21' into 'master'11.21
add upstream 11.21 See merge request opensource-tracking/FreeFileSync!44
Diffstat (limited to 'zen/error_log.h')
-rw-r--r--zen/error_log.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/zen/error_log.h b/zen/error_log.h
index a24dfe5a..357232f3 100644
--- a/zen/error_log.h
+++ b/zen/error_log.h
@@ -11,7 +11,6 @@
#include <vector>
#include "time.h"
#include "i18n.h"
-#include "utf.h"
#include "zstring.h"
@@ -37,7 +36,7 @@ std::string formatMessage(const LogEntry& entry);
class ErrorLog
{
public:
- void logMsg(const std::wstring& msg, MessageType type);
+ void logMsg(const std::wstring& msg, MessageType type, time_t time = std::time(nullptr));
struct Stats
{
@@ -66,9 +65,9 @@ private:
//######################## implementation ##########################
inline
-void ErrorLog::logMsg(const std::wstring& msg, MessageType type)
+void ErrorLog::logMsg(const std::wstring& msg, MessageType type, time_t time)
{
- entries_.push_back({std::time(nullptr), type, utfTo<Zstringc>(msg)});
+ entries_.push_back({time, type, utfTo<Zstringc>(msg)});
}
@@ -119,14 +118,13 @@ std::string formatMessage(const LogEntry& entry)
const size_t prefixLen = unicodeLength(msgFmt); //consider Unicode!
const Zstringc msg = trimCpy(entry.message);
- static_assert(std::is_same_v<decltype(msg), const Zstringc>, "don't worry about copying as long as we're using a ref-counted string!");
+ static_assert(std::is_same_v<decltype(msg), const Zstringc>, "no worries about copying as long as we're using a ref-counted string!");
for (auto it = msg.begin(); it != msg.end(); )
if (*it == '\n')
{
- msgFmt += '\n';
+ msgFmt += *it++;
msgFmt.append(prefixLen, ' ');
- ++it;
//skip duplicate newlines
for (; it != msg.end() && *it == '\n'; ++it)
;
bgstack15