Fix log head/tail functions.
[dcpomatic.git] / src / tools / dcpomatic_server.cc
index a82478dfdbd47fc3a9e27985bff669eddd8c678f..58310377c04301774b7c77120e334d804a17b094 100644 (file)
@@ -47,6 +47,14 @@ public:
                return _log;
        }
 
+       string head_and_tail (int amount = 1024) const {
+               if (_log.size () < (2 * amount)) {
+                       return _log;
+               }
+
+               return _log.substr (0, amount) + _log.substr (_log.size() - amount - 1, amount);
+       }
+
 private:
        void do_log (string m)
        {