43 : m_stream(s), m_max_history_size(max_history_size)
64 std::string::size_type p = str.find_first_of(
'\n');
66 if ( p == std::string::npos )
67 m_current_line += str;
71 m_current_line += str.substr(0, p);
73 output_current_line();
75 if ( p != str.length() )
76 write( str.substr(p) );
93void claw::log_stream_concise::output_current_line()
96 (m_previous_lines.begin(), m_previous_lines.end(), m_current_line)
97 == m_previous_lines.end() )
99 m_previous_lines.push_back( m_current_line );
100 m_stream->write( m_current_line );
102 if (m_previous_lines.size() > m_max_history_size)
103 m_previous_lines.pop_front();
106 m_current_line.clear();
log_stream_concise(log_stream *s, std::size_t max_history_size=25)
Constructor.
virtual ~log_stream_concise()
Destructor.
virtual void write(const std::string &str)
Write a string in the stream.
virtual void flush()
Flush the stream.
Base class for streams accepting log output.
A log stream that does not output a message that have been recently output.