libzypp  17.23.8
zypp::base::logger::LogControlImpl Struct Reference

LogControl implementation (Singleton). More...

Public Member Functions

bool isExcessive ()
void excessive (bool onOff_r)
void setLineWriter (const shared_ptr< LogControl::LineWriter > &writer_r)
 NULL _lineWriter indicates no loggin. More...
shared_ptr< LogControl::LineWritergetLineWriter () const
void setLineFormater (const shared_ptr< LogControl::LineFormater > &format_r)
 Assert _lineFormater is not NULL. More...
void logfile (const Pathname &logfile_r, mode_t mode_r=0640)
std::ostream & getStream (const std::string &group_r, LogLevel level_r, const char *file_r, const char *func_r, const int line_r)
 Provide the log stream to write (logger interface) More...
void putStream (const std::string &group_r, LogLevel level_r, const char *file_r, const char *func_r, int line_r, const std::string &message_r)
 Format and write out a logline from Loglinebuf. More...

Static Public Member Functions

static LogControlImplinstance ()
 The LogControlImpl singleton. More...

Private Types

typedef shared_ptr< LoglinestreamStreamPtr
typedef std::map< LogLevel, StreamPtrStreamSet
typedef std::map< std::string, StreamSetStreamTable

Private Member Functions

 LogControlImpl ()
 Singleton ctor. More...
 ~LogControlImpl ()

Private Attributes

std::ostream _no_stream
bool _excessive
shared_ptr< LogControl::LineFormater_lineFormater
shared_ptr< LogControl::LineWriter_lineWriter
StreamTable _streamtable
 one streambuffer per group and level More...

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const LogControlImpl &obj)

Detailed Description

LogControl implementation (Singleton).

There is a slight difference in using the _lineFormater and _lineWriter!
  • _lineFormater must not be NULL (create default LogControl::LineFormater)
  • _lineWriter is NULL if no logging is performed, this way we can pass _no_stream as logstream to the application, and avoid unnecessary formating of logliles, which would then be discarded when passed to some dummy LineWriter.

Definition at line 280 of file

Member Typedef Documentation

◆ StreamPtr

◆ StreamSet

Definition at line 364 of file

◆ StreamTable

typedef std::map<std::string,StreamSet> zypp::base::logger::LogControlImpl::StreamTable

Definition at line 365 of file

Constructor & Destructor Documentation

◆ LogControlImpl()

zypp::base::logger::LogControlImpl::LogControlImpl ( )

Singleton ctor.

No logging per default, unless enabled via $ZYPP_LOGFILE.

Definition at line 373 of file

◆ ~LogControlImpl()

zypp::base::logger::LogControlImpl::~LogControlImpl ( )

Definition at line 388 of file

Member Function Documentation

◆ isExcessive()

bool zypp::base::logger::LogControlImpl::isExcessive ( )

Definition at line 283 of file

◆ excessive()

void zypp::base::logger::LogControlImpl::excessive ( bool  onOff_r)

Definition at line 286 of file

◆ setLineWriter()

void zypp::base::logger::LogControlImpl::setLineWriter ( const shared_ptr< LogControl::LineWriter > &  writer_r)

NULL _lineWriter indicates no loggin.

Definition at line 290 of file

◆ getLineWriter()

shared_ptr<LogControl::LineWriter> zypp::base::logger::LogControlImpl::getLineWriter ( ) const

Definition at line 293 of file

◆ setLineFormater()

void zypp::base::logger::LogControlImpl::setLineFormater ( const shared_ptr< LogControl::LineFormater > &  format_r)

Assert _lineFormater is not NULL.

Definition at line 297 of file

◆ logfile()

void zypp::base::logger::LogControlImpl::logfile ( const Pathname logfile_r,
mode_t  mode_r = 0640 

Definition at line 305 of file

◆ getStream()

std::ostream& zypp::base::logger::LogControlImpl::getStream ( const std::string &  group_r,
LogLevel  level_r,
const char *  file_r,
const char *  func_r,
const int  line_r 

Provide the log stream to write (logger interface)

Definition at line 324 of file

◆ putStream()

void zypp::base::logger::LogControlImpl::putStream ( const std::string &  group_r,
LogLevel  level_r,
const char *  file_r,
const char *  func_r,
int  line_r,
const std::string &  message_r 

Format and write out a logline from Loglinebuf.

Definition at line 349 of file

◆ instance()

LogControlImpl & zypp::base::logger::LogControlImpl::instance ( )

The LogControlImpl singleton.

As most dtors log, it is inportant that the LogControlImpl instance is the last static variable destructed. At least destucted after all statics which log from their dtor.

Definition at line 405 of file

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  str,
const LogControlImpl obj 

Stream output

Definition at line 414 of file

Member Data Documentation

◆ _no_stream

std::ostream zypp::base::logger::LogControlImpl::_no_stream

Definition at line 316 of file

◆ _excessive

bool zypp::base::logger::LogControlImpl::_excessive

Definition at line 317 of file

◆ _lineFormater

shared_ptr<LogControl::LineFormater> zypp::base::logger::LogControlImpl::_lineFormater

Definition at line 319 of file

◆ _lineWriter

shared_ptr<LogControl::LineWriter> zypp::base::logger::LogControlImpl::_lineWriter

Definition at line 320 of file

◆ _streamtable

StreamTable zypp::base::logger::LogControlImpl::_streamtable

one streambuffer per group and level

Definition at line 367 of file

The documentation for this struct was generated from the following file: