diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:50 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:50 +0200 |
commit | 7e706cf64654aea466c059c307e5723e2423ed5d (patch) | |
tree | e85f0d28d7c81b6d21419fc38e1a654cca2212b1 /lib/generate_logfile.h | |
parent | 5.5 (diff) | |
download | FreeFileSync-7e706cf64654aea466c059c307e5723e2423ed5d.tar.gz FreeFileSync-7e706cf64654aea466c059c307e5723e2423ed5d.tar.bz2 FreeFileSync-7e706cf64654aea466c059c307e5723e2423ed5d.zip |
5.6
Diffstat (limited to 'lib/generate_logfile.h')
-rw-r--r-- | lib/generate_logfile.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/generate_logfile.h b/lib/generate_logfile.h index 8feb696a..b54b4893 100644 --- a/lib/generate_logfile.h +++ b/lib/generate_logfile.h @@ -9,8 +9,8 @@ #include <zen/error_log.h> #include <zen/file_io.h> +#include <zen/serialize.h> #include <wx+/format_unit.h> -#include <wx+/serialize.h> #include "ffs_paths.h" @@ -129,7 +129,18 @@ void saveToLastSyncsLog(const Utf8String& logstream) //throw FileError } //limit file size: 128 kB (but do not truncate new log) - newStream.resize(std::min(newStream.size(), std::max<size_t>(logstream.size(), 128 * 1024))); + const size_t newSize = std::min(newStream.size(), std::max<size_t>(logstream.size(), 128 * 1024)); + + //do not cut in the middle of a row + auto iter = std::search(newStream.begin() + newSize, newStream.end(), std::begin(LINE_BREAK), std::end(LINE_BREAK) - 1); + if (iter != newStream.end()) + { + newStream.resize(iter - newStream.begin()); + + newStream += LINE_BREAK; + newStream += "[...]"; + newStream += LINE_BREAK; + } saveBinStream(filename, newStream); //throw FileError } |