26 #include <SimoxUtility/algorithm/string/string_tools.h>
30 flushOnlyOnNewLine(flushOnlyOnNewLine)
32 _outBuffer.reserve(1024);
33 char* base = &_buffer.front();
34 setp(base, base + _buffer.size() - 1);
39 int armarx::ArmarXLogBuf::overflow(
int c)
41 std::unique_lock lock(mutex);
47 if (epptr() == pptr())
57 int armarx::ArmarXLogBuf::sync()
59 std::unique_lock lock(mutex);
64 void armarx::ArmarXLogBuf::write()
66 for (
char* p = pbase(), *e = pptr(); p != e; ++p)
70 std::ptrdiff_t n = pptr() - pbase();
74 void armarx::ArmarXLogBuf::flush()
77 if (!flushOnlyOnNewLine)
79 simox::alg::trim(_outBuffer);
81 if (_outBuffer.size() == 0)
89 if (!flushOnlyOnNewLine || _outBuffer.find(
'\n') != std::string::npos)