Example #1
0
// MANIPULATORS
void my_Logger::logMessage(const bsl::string& message, Severity severity)
{
    archive.push_back(message);
    switch (severity) {
      case TRACE: {
        // Do nothing beyond archiving the message.
      } break;
      case WARN: {
        ball::Context context(ball::Transmission::e_PASSTHROUGH, 0, 1);
        publish(message, context);
      } break;
      case ERROR: {
        int index  = 0;
        int length = (int)archive.size();
        ball::Context context(ball::Transmission::e_TRIGGER, index, length);
        while (length--) {
            publish(archive[length], context);
            context.setRecordIndexRaw(++index);
        }
        archive.clear();  // flush archive
      } break;
    }
}
Example #2
0
 inline
 void my_RecordBuffer::removeAll()
 {
     bslmt::LockGuard<bslmt::RecursiveMutex> guard(&d_mutex);
     d_buffer.clear();
 }