Main Page · Modules · All Classes · Class Hierarchy
Public Types | Static Public Member Functions | Static Protected Member Functions | List of all members
MCLog Class Reference

Basic log functionalities. More...

#include <MCLog.hpp>

Public Types

Static Public Member Functions

static bool GetDebugStatus (bool global=false)
 Get debug status. More...
 
static void SetDebugStatus (bool new_status, bool global=false)
 Set debug status. More...
 
static std::string GetDebugFilter ()
 Get debug filter. More...
 
static void SetDebugFilter (const std::string &new_filter)
 Set debug filter. More...
 
static std::string GetDebugColorFilters ()
 Get debug color filter. More...
 
static void SetDebugColorFilters (const std::string &new_color_filters)
 Set debug color filters. More...
 
static void SetCustomHandler (MCLogMessageHandler *handler, bool global=false)
 Set custom message handler. More...
 
static void LogMessage (const char *function, const char *format,...)
 Print log message. More...
 
static void ErrorMessage (const char *function, const char *format,...) CLANG_ANALYZER_NORETURN
 Print error message with red color. More...
 
static void WarningMessage (const char *function, const char *format,...)
 Print warning message with yellow color. More...
 
static void FormattedMessage (MCLog::ColorType color, bool bold, const char *format,...)
 Print normal message. More...
 
static QString ConvertFromAnsiToQtMarkup (const QString &orig_str)
 Convert the ANSI codes to Qt markup format. More...
 
static QString RemoveMarkup (const QString &orig_str)
 Remove the markup. More...
 

Static Protected Member Functions

static bool IsAnyFilterMatched (const MC::StringList &filters, const std::string &function_name)
 Check if any filter matches with the function name. More...
 

Detailed Description

Basic log functionalities.

Definition at line 57 of file MCLog.hpp.

Member Enumeration Documentation

Types of message colors

Enumerator
MinColor 

Minimum value

Black 

Black color

Red 

Red color

Green 

Green color

Yellow 

Yellow color

Blue 

Blue color

Purple 

Purple color

Cyan 

Cyan color

White 

White color

NoColor 

No color

MaxColor 

Maximum value

Definition at line 61 of file MCLog.hpp.

Types of messages

Enumerator
Normal 

Normal message

Warning 

Warning message

Error 

Error message

Definition at line 77 of file MCLog.hpp.

Member Function Documentation

QString MCLog::ConvertFromAnsiToQtMarkup ( const QString &  orig_str)
static

Convert the ANSI codes to Qt markup format.

Parameters
orig_strOriginal string
Returns
Converted string.

Definition at line 374 of file MCLog.cpp.

void MCLog::ErrorMessage ( const char *  function,
const char *  format,
  ... 
)
static

Print error message with red color.

Parameters
functionFunction name
formatFormat string and its parameters of the error message

Definition at line 229 of file MCLog.cpp.

void MCLog::FormattedMessage ( MCLog::ColorType  color,
bool  bold,
const char *  format,
  ... 
)
static

Print normal message.

Parameters
colorMessage color
boldBold letters
formatFormat string and its parameters of the error message

Definition at line 321 of file MCLog.cpp.

std::string MCLog::GetDebugColorFilters ( )
static

Get debug color filter.

Returns
Debug color filter

Definition at line 105 of file MCLog.cpp.

std::string MCLog::GetDebugFilter ( )
static

Get debug filter.

Returns
Debug filter

Definition at line 91 of file MCLog.cpp.

bool MCLog::GetDebugStatus ( bool  global = false)
static

Get debug status.

Parameters
globalWhenever the global status is queried or only a thread local
Returns
Boolean status of debug (true = enabled, false = disabled).

Definition at line 68 of file MCLog.cpp.

bool MCLog::IsAnyFilterMatched ( const MC::StringList &  filters,
const std::string &  function_name 
)
staticprotected

Check if any filter matches with the function name.

Parameters
filtersFilters
function_nameFunction name
Returns
Boolean status of debug (true = enabled, false = disabled).

Definition at line 128 of file MCLog.cpp.

void MCLog::LogMessage ( const char *  function,
const char *  format,
  ... 
)
static

Print log message.

Parameters
functionFunction name
formatFormat string and its parameters of the debug message

Definition at line 166 of file MCLog.cpp.

QString MCLog::RemoveMarkup ( const QString &  orig_str)
static

Remove the markup.

Parameters
orig_strOriginal string
Returns
Plain string.

Definition at line 432 of file MCLog.cpp.

void MCLog::SetCustomHandler ( MCLogMessageHandler handler,
bool  global = false 
)
static

Set custom message handler.

Parameters
handlerCustom message handler
globalWhenever the global handler is set or only a thread local

Note: The ownership of the handler class is taken, it is destroyed automatically.

Definition at line 119 of file MCLog.cpp.

void MCLog::SetDebugColorFilters ( const std::string &  new_color_filters)
static

Set debug color filters.

Parameters
new_color_filtersNew color filter of the global debug

Definition at line 112 of file MCLog.cpp.

void MCLog::SetDebugFilter ( const std::string &  new_filter)
static

Set debug filter.

Parameters
new_filterNew filter of the global debug

Definition at line 98 of file MCLog.cpp.

void MCLog::SetDebugStatus ( bool  new_status,
bool  global = false 
)
static

Set debug status.

Parameters
globalWhenever the global status is set or only a thread local
new_statusNew status of global debug (true = enabled, false = disabled)

Definition at line 79 of file MCLog.cpp.

void MCLog::WarningMessage ( const char *  function,
const char *  format,
  ... 
)
static

Print warning message with yellow color.

Parameters
functionFunction name
formatFormat string and its parameters of the error message

Definition at line 279 of file MCLog.cpp.


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