retdec
Public Types | Static Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
retdec::utils::io::Log Class Reference

#include <log.h>

Collaboration diagram for retdec::utils::io::Log:
Collaboration graph
[legend]

Public Types

enum class  Type : int { Info = 0 , Debug , Error , Undefined }
 
using Color = Logger::Color
 
using Action = Logger::Action
 

Static Public Member Functions

static Loggerget (const Type &logType)
 
static void set (const Type &logType, Logger::Ptr &&logger)
 
static Logger info ()
 
static Logger debug ()
 
static Logger error ()
 
static void phase (const std::string &phaseId, const Log::Action &action=Log::Action::Phase)
 

Static Public Attributes

static const Action Error = Log::Action::Error
 
static const Action Warning = Log::Action::Warning
 
static const Action Phase = Log::Action::Phase
 
static const Action SubPhase = Log::Action::SubPhase
 
static const Action SubSubPhase = Log::Action::SubSubPhase
 
static const Action ElapsedTime = Log::Action::ElapsedTime
 

Static Private Attributes

static Logger::Ptr writers [static_cast< int >(Type::Undefined)+1]
 
static Logger defaultLogger
 

Member Typedef Documentation

◆ Action

◆ Color

Member Enumeration Documentation

◆ Type

enum retdec::utils::io::Log::Type : int
strong

Each type represents different logging style. For each type is provided a logger by calling Log::get function

Enumerator
Info 
Debug 
Error 
Undefined 

Member Function Documentation

◆ debug()

Logger retdec::utils::io::Log::debug ( )
static

Shortcut for Logger(Log::get(Log::Type::Debug)).

Creates temporary copy of Debug logger. This is particularly useful when changing color of the output. On destruction color is changed to default.

◆ error()

Logger retdec::utils::io::Log::error ( )
static

Shortcut for Logger(Log::get(Log::Type::Error)).

Creates temporary copy of Error logger. This is particularly useful when changing color of the output. On destruction color is changed to default.

◆ get()

Logger & retdec::utils::io::Log::get ( const Type logType)
static

Returns corresponding initialized logger for logType provided as parameter. At the beginning all the logger types are initialized to default logger.

For debug/info:

  • verbose
  • logs to std::out

For error:

  • verbose
  • logs to std::err

◆ info()

Logger retdec::utils::io::Log::info ( )
static

Shortcut for Logger(Log::get(Log::Type::Info)).

Creates temporary copy of Info logger. This is particularly useful when changing color of the output. On destruction color is changed to default.

◆ phase()

void retdec::utils::io::Log::phase ( const std::string &  phaseId,
const Log::Action action = Log::Action::Phase 
)
static

Shortcut for Log::info() << action << phaseId << Log::Action::ElapsedTime << std::endl.

◆ set()

void retdec::utils::io::Log::set ( const Type logType,
Logger::Ptr &&  logger 
)
static

Sets appropriate logger based on logType value.

Member Data Documentation

◆ defaultLogger

Logger retdec::utils::io::Log::defaultLogger
staticprivate

Fallback logger. In case of bad initialization of the writers this logger is used as fallback to log (calling set with nullptr).

◆ ElapsedTime

const Log::Action retdec::utils::io::Log::ElapsedTime = Log::Action::ElapsedTime
static

Representation of ElapsedTime Action that can be inserted into logger. Shortcut for Log::Action::ElapsedTime

◆ Error

const Log::Action retdec::utils::io::Log::Error = Log::Action::Error
static

Representation of Error Action that can be inserted into logger. Shortcut for Log::Action::Error

◆ Phase

const Log::Action retdec::utils::io::Log::Phase = Log::Action::Phase
static

Representation of Phase Action that can be inserted into logger. Shortcut for Log::Action::Phase

◆ SubPhase

const Log::Action retdec::utils::io::Log::SubPhase = Log::Action::SubPhase
static

Representation of SubPhase Action that can be inserted into logger. Shortcut for Log::Action::SubPhase

◆ SubSubPhase

const Log::Action retdec::utils::io::Log::SubSubPhase = Log::Action::SubSubPhase
static

Representation of SubSubPhase Action that can be inserted into logger. Shortcut for Log::Action::SubSubPhase

◆ Warning

const Log::Action retdec::utils::io::Log::Warning = Log::Action::Warning
static

Representation of Warning Action that can be inserted into logger. Shortcut for Log::Action::Warning

◆ writers

Logger::Ptr retdec::utils::io::Log::writers
staticprivate
Initial value:
= {
nullptr,
nullptr,
Logger::Ptr(new Logger(std::cerr)),
Logger::Ptr(new Logger(std::cout, false))
}
std::unique_ptr< Logger > Ptr
Definition: logger.h:24

Structure containing initialized/default loggers.


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