ngscopeclient 0.1-dev+51fbda87c
Public Member Functions | Protected Member Functions | List of all members
ColoredSTDLogSink Class Reference

A STDLogSink that colorizes "warning" or "error" keywords. More...

#include <log.h>

Inheritance diagram for ColoredSTDLogSink:
Inheritance graph
[legend]
Collaboration diagram for ColoredSTDLogSink:
Collaboration graph
[legend]

Public Member Functions

 ColoredSTDLogSink (Severity min_severity=Severity::VERBOSE)
 
- Public Member Functions inherited from STDLogSink
 STDLogSink (Severity min_severity=Severity::VERBOSE)
 
void Log (Severity severity, const std::string &msg) override
 
void Log (Severity severity, const char *format, va_list va) override
 
- Public Member Functions inherited from LogSink
 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

void PreprocessLine (std::string &line) override
 Do any processing required to a line before printing it. Nothing in the base class. More...
 
std::string replace (const std::string &search, const std::string &before, const std::string &after, std::string subject)
 Replaces warning keywords with ANSI escape sequences. More...
 
- Protected Member Functions inherited from STDLogSink
void Flush ()
 
- Protected Member Functions inherited from LogSink
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...
 

Additional Inherited Members

- Protected Attributes inherited from LogSink
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

A STDLogSink that colorizes "warning" or "error" keywords.

Member Function Documentation

◆ PreprocessLine()

void ColoredSTDLogSink::PreprocessLine ( std::string &  line)
overrideprotectedvirtual

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

Reimplemented from LogSink.

◆ replace()

string ColoredSTDLogSink::replace ( const std::string &  search,
const std::string &  before,
const std::string &  after,
std::string  subject 
)
protected

Replaces warning keywords with ANSI escape sequences.

Parameters
searchString to look for
beforePrepended to the output if matched
afterInserted after the search string if matched
subjectInput string
Colorizedstring

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