ngscopeclient 0.1-dev+51fbda87c
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LogSink Class Referenceabstract

Base class for all log sinks. More...

#include <log.h>

Inheritance diagram for LogSink:
Inheritance graph
[legend]

Public Member Functions

 LogSink (Severity min_severity=Severity::VERBOSE)
 
Severity GetSeverity ()
 Returns the current severity / verbosity level.
 
std::string GetIndentString ()
 Gets the indent string (for now, only used by STDLogSink) More...
 
virtual void Log (Severity severity, const std::string &msg)=0
 
virtual void Log (Severity severity, const char *format, va_list va)=0
 
std::string vstrprintf (const char *format, va_list va)
 Like sprintf, but self-managing a buffer with a std::string.
 

Protected Member Functions

std::string WrapString (std::string str)
 Wraps long lines and adds indentation as needed.
 
virtual void PreprocessLine (std::string &line)
 Do any processing required to a line before printing it. Nothing in the base class. More...
 

Protected Attributes

unsigned int m_indentSize
 Number of spaces in one indentation.
 
unsigned int m_termWidth
 Width of the console we're printing to, in characters.
 
bool m_lastMessageWasNewline
 True if the last message ended in a
character.
 
Severity m_min_severity
 Minimum severity of messages to be printed.
 

Detailed Description

Base class for all log sinks.

Member Function Documentation

◆ GetIndentString()

string LogSink::GetIndentString ( )

Gets the indent string (for now, only used by STDLogSink)

Each log message printed is prefixed with (indentLevel * indentSize) space characters. No parsing of newline etc characters is performed.

◆ PreprocessLine()

void LogSink::PreprocessLine ( std::string &  line)
protectedvirtual

Do any processing required to a line before printing it. Nothing in the base class.

Reimplemented in ColoredSTDLogSink.


The documentation for this class was generated from the following files: