some changes to take care of activity

This commit is contained in:
Robin Müller 2020-06-03 23:02:23 +02:00
parent 3483dff2ab
commit 1c0ca4c329

View File

@ -33,7 +33,7 @@ void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
#endif #endif
int ServiceInterfaceBuffer::overflow(int c) { int ServiceInterfaceBuffer::overflow(int c) {
if(errStream) { if(errStream and this->isActive) {
if (c != Traits::eof()) { if (c != Traits::eof()) {
printChar(reinterpret_cast<const char*>(&c), true); printChar(reinterpret_cast<const char*>(&c), true);
} }
@ -53,17 +53,18 @@ int ServiceInterfaceBuffer::overflow(int c) {
} }
int ServiceInterfaceBuffer::sync(void) { int ServiceInterfaceBuffer::sync(void) {
if(errStream) { if(not this->isActive or errStream) {
if(not errStream) {
setp(buf, buf + BUF_SIZE - 1);
}
return 0; return 0;
} }
if (this->isActive) { auto preamble = getPreamble();
auto preamble = getPreamble(); // Write logMessage and time
// Write logMessage and time this->putChars(preamble.c_str(), preamble.c_str() + preamble.size());
this->putChars(preamble.c_str(), preamble.c_str() + preamble.size()); // Handle output
// Handle output this->putChars(pbase(), pptr());
this->putChars(pbase(), pptr());
}
// This tells that buffer is empty again // This tells that buffer is empty again
setp(buf, buf + BUF_SIZE - 1); setp(buf, buf + BUF_SIZE - 1);
return 0; return 0;