R-Type  2
Doom but in better
Loading...
Searching...
No Matches
LogMacros.hpp File Reference

Macro definitions for logging messages with varying levels of detail and formatting. More...

#include "Log.hpp"
Include dependency graph for LogMacros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define COLOUR_LOG_DISABLED   Logging::isRedirected()
 
#define _LOG_CORE
 
#define _DEBUG_STR   " DEBUG: "
 Debug log level string.
 
#define _INFO_STR   " INFO: "
 Info log level string.
 
#define _SUCCESS_STR   " SUCCESS: "
 Success log level string.
 
#define _WARNING_STR   " WARNING: "
 Warning log level string.
 
#define _ERROR_STR   " ERROR: "
 Error log level string.
 
#define _CRITICAL_STR   " CRITICAL: "
 Critical log level string.
 
#define _LOG_COLOURS
 
#define BACKGROUND_COL   ""
 Empty colour codes for unsupported platforms.
 
#define DEFAULT_FG   ""
 
#define RESET_COL   ""
 
#define DEBUG_COL   ""
 
#define SUCCESS_COL   ""
 
#define INFO_COL   ""
 
#define WARNING_COL   ""
 
#define ERROR_COL   ""
 
#define CRITICAL_COL   ""
 
#define _FUNC_NAME   "Function name: (" << __func__ << ')'
 Get the name of the function based on the compiler version.
 
#define _MY_FILE_GETTER   " " << __FILE__ << ":" << __LINE__ << " " << _FUNC_NAME << ": "
 Formats detailed logging information with file, line, and function details.
 
#define _MY_COLOURED_FILE_GETTER   BACKGROUND_COL << DEFAULT_FG << " " << SUCCESS_COL << __FILE__ << DEFAULT_FG << ":" << INFO_COL << __LINE__ << DEFAULT_FG << " " << WARNING_COL << _FUNC_NAME << DEFAULT_FG << ": "
 Formats detailed logging information with file, line, and function details in a colourised form.
 
#define _LOG_LEVELS
 
#define LOG_DEBUG   Logging::Log::getInstance(true) << _DEBUG_STR
 Debug log level.
 
#define LOG_SUCCESS   Logging::Log::getInstance(false) << _SUCCESS_STR
 Success log level.
 
#define LOG_INFO   Logging::Log::getInstance(false) << _INFO_STR
 Info log level.
 
#define LOG_WARNING   Logging::Log::getInstance(false) << _WARNING_STR
 Warning log level.
 
#define LOG_ERROR   Logging::Log::getInstance(false) << _ERROR_STR
 Error log level.
 
#define LOG_CRITICAL   Logging::Log::getInstance(false) << _CRITICAL_STR
 Critical log level.
 
#define _PRECISE_LOG
 
#define PRECISE_DEBUG   Logging::Log::getInstance(true) << _DEBUG_STR << _MY_FILE_GETTER
 Debug log with precise details.
 
#define PRECISE_SUCCESS   Logging::Log::getInstance(false) << _SUCCESS_STR << _MY_FILE_GETTER
 Success log with precise details.
 
#define PRECISE_INFO   Logging::Log::getInstance(false) << _INFO_STR << _MY_FILE_GETTER
 Info log with precise details.
 
#define PRECISE_WARNING   Logging::Log::getInstance(false) << _WARNING_STR << _MY_FILE_GETTER
 Warning log with precise details.
 
#define PRECISE_ERROR   Logging::Log::getInstance(false) << _ERROR_STR << _MY_FILE_GETTER
 Error log with precise details.
 
#define PRECISE_CRITICAL   Logging::Log::getInstance(false) << _CRITICAL_STR << _MY_FILE_GETTER
 Critical log with precise details.
 
#define _COLOUR_LOG
 
#define COLOUR_DEBUG   Logging::Log::getInstance(true) << RESET_COL << BACKGROUND_COL << DEBUG_COL << _DEBUG_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG
 Debug log with colour.
 
#define COLOUR_SUCCESS   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << SUCCESS_COL << _SUCCESS_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG
 Success log with colour.
 
#define COLOUR_INFO   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << INFO_COL << _INFO_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG
 Info log with colour.
 
#define COLOUR_WARNING   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << WARNING_COL << _WARNING_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG
 Warning log with colour.
 
#define COLOUR_ERROR   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << ERROR_COL << _ERROR_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG
 Error log with colour.
 
#define COLOUR_CRITICAL   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << CRITICAL_COL << _CRITICAL_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG
 Critical log with colour.
 
#define _PRETTY_LOG
 
#define PRETTY_DEBUG   Logging::Log::getInstance(true) << RESET_COL << BACKGROUND_COL << DEBUG_COL << _DEBUG_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG << _MY_COLOURED_FILE_GETTER
 Debug log with details and colour.
 
#define PRETTY_SUCCESS   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << SUCCESS_COL << _SUCCESS_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG << _MY_COLOURED_FILE_GETTER
 Success log with details and colour.
 
#define PRETTY_INFO   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << INFO_COL << _INFO_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG << _MY_COLOURED_FILE_GETTER
 Info log with details and colour.
 
#define PRETTY_WARNING   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << WARNING_COL << _WARNING_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG << _MY_COLOURED_FILE_GETTER
 Warning log with details and colour.
 
#define PRETTY_ERROR   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << ERROR_COL << _ERROR_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG << _MY_COLOURED_FILE_GETTER
 Error log with details and colour.
 
#define PRETTY_CRITICAL   Logging::Log::getInstance(false) << RESET_COL << BACKGROUND_COL << CRITICAL_COL << _CRITICAL_STR << RESET_COL << BACKGROUND_COL << DEFAULT_FG << _MY_COLOURED_FILE_GETTER
 Critical log with details and colour.
 

Detailed Description

Macro definitions for logging messages with varying levels of detail and formatting.

This file defines macros for logging purposes, including various log levels (e.g., DEBUG, INFO, SUCCESS, etc.), optional colourized output, and detailed output with file, line, and function information.

  • Log Levels:
  • DEBUG: Used for debugging information.
  • INFO: General informational messages.
  • SUCCESS: Indicates successful operations.
  • WARNING: Highlights warnings requiring attention.
  • ERROR: Non-critical errors.
  • CRITICAL: Critical errors requiring program termination.
  • Optional Features:
  • Colorized output for better visibility.
  • Enhanced logging with detailed file, line, and function information.
  • Variants with and without colour and detailed information.
Note
Customize the log macros by defining or omitting certain preprocessor variables:
  • NO_LOG_COLOURS: Disables colourized output.
  • _MY_FILE_GETTER: Customizes how file, line, and function information is displayed.

Definition in file LogMacros.hpp.

Macro Definition Documentation

◆ _COLOUR_LOG

#define _COLOUR_LOG

Definition at line 170 of file LogMacros.hpp.

◆ _CRITICAL_STR

#define _CRITICAL_STR   " CRITICAL: "

Critical log level string.

Definition at line 50 of file LogMacros.hpp.

◆ _DEBUG_STR

#define _DEBUG_STR   " DEBUG: "

Debug log level string.

Definition at line 45 of file LogMacros.hpp.

◆ _ERROR_STR

#define _ERROR_STR   " ERROR: "

Error log level string.

Definition at line 49 of file LogMacros.hpp.

◆ _FUNC_NAME

#define _FUNC_NAME   "Function name: (" << __func__ << ')'

Get the name of the function based on the compiler version.

Definition at line 108 of file LogMacros.hpp.

◆ _INFO_STR

#define _INFO_STR   " INFO: "

Info log level string.

Definition at line 46 of file LogMacros.hpp.

◆ _LOG_COLOURS

#define _LOG_COLOURS

Definition at line 55 of file LogMacros.hpp.

◆ _LOG_CORE

#define _LOG_CORE

Definition at line 44 of file LogMacros.hpp.

◆ _LOG_LEVELS

#define _LOG_LEVELS

Definition at line 134 of file LogMacros.hpp.

◆ _MY_COLOURED_FILE_GETTER

#define _MY_COLOURED_FILE_GETTER   BACKGROUND_COL << DEFAULT_FG << " " << SUCCESS_COL << __FILE__ << DEFAULT_FG << ":" << INFO_COL << __LINE__ << DEFAULT_FG << " " << WARNING_COL << _FUNC_NAME << DEFAULT_FG << ": "

Formats detailed logging information with file, line, and function details in a colourised form.

Definition at line 123 of file LogMacros.hpp.

◆ _MY_FILE_GETTER

#define _MY_FILE_GETTER   " " << __FILE__ << ":" << __LINE__ << " " << _FUNC_NAME << ": "

Formats detailed logging information with file, line, and function details.

Definition at line 116 of file LogMacros.hpp.

◆ _PRECISE_LOG

#define _PRECISE_LOG

Definition at line 152 of file LogMacros.hpp.

◆ _PRETTY_LOG

#define _PRETTY_LOG

Definition at line 188 of file LogMacros.hpp.

◆ _SUCCESS_STR

#define _SUCCESS_STR   " SUCCESS: "

Success log level string.

Definition at line 47 of file LogMacros.hpp.

◆ _WARNING_STR

#define _WARNING_STR   " WARNING: "

Warning log level string.

Definition at line 48 of file LogMacros.hpp.

◆ BACKGROUND_COL

#define BACKGROUND_COL   ""

Empty colour codes for unsupported platforms.

Definition at line 74 of file LogMacros.hpp.

◆ COLOUR_CRITICAL

Critical log with colour.

Definition at line 176 of file LogMacros.hpp.

◆ COLOUR_DEBUG

Debug log with colour.

Definition at line 171 of file LogMacros.hpp.

◆ COLOUR_ERROR

Error log with colour.

Definition at line 175 of file LogMacros.hpp.

◆ COLOUR_INFO

Info log with colour.

Definition at line 173 of file LogMacros.hpp.

◆ COLOUR_LOG_DISABLED

#define COLOUR_LOG_DISABLED   Logging::isRedirected()

Definition at line 40 of file LogMacros.hpp.

◆ COLOUR_SUCCESS

Success log with colour.

Definition at line 172 of file LogMacros.hpp.

◆ COLOUR_WARNING

Warning log with colour.

Definition at line 174 of file LogMacros.hpp.

◆ CRITICAL_COL

#define CRITICAL_COL   ""

Definition at line 82 of file LogMacros.hpp.

◆ DEBUG_COL

#define DEBUG_COL   ""

Definition at line 77 of file LogMacros.hpp.

◆ DEFAULT_FG

#define DEFAULT_FG   ""

Definition at line 75 of file LogMacros.hpp.

◆ ERROR_COL

#define ERROR_COL   ""

Definition at line 81 of file LogMacros.hpp.

◆ INFO_COL

#define INFO_COL   ""

Definition at line 79 of file LogMacros.hpp.

◆ LOG_CRITICAL

#define LOG_CRITICAL   Logging::Log::getInstance(false) << _CRITICAL_STR

Critical log level.

Definition at line 140 of file LogMacros.hpp.

◆ LOG_DEBUG

#define LOG_DEBUG   Logging::Log::getInstance(true) << _DEBUG_STR

Debug log level.

Definition at line 135 of file LogMacros.hpp.

◆ LOG_ERROR

#define LOG_ERROR   Logging::Log::getInstance(false) << _ERROR_STR

Error log level.

Definition at line 139 of file LogMacros.hpp.

◆ LOG_INFO

#define LOG_INFO   Logging::Log::getInstance(false) << _INFO_STR

Info log level.

Definition at line 137 of file LogMacros.hpp.

◆ LOG_SUCCESS

#define LOG_SUCCESS   Logging::Log::getInstance(false) << _SUCCESS_STR

Success log level.

Definition at line 136 of file LogMacros.hpp.

◆ LOG_WARNING

#define LOG_WARNING   Logging::Log::getInstance(false) << _WARNING_STR

Warning log level.

Definition at line 138 of file LogMacros.hpp.

◆ PRECISE_CRITICAL

#define PRECISE_CRITICAL   Logging::Log::getInstance(false) << _CRITICAL_STR << _MY_FILE_GETTER

Critical log with precise details.

Definition at line 158 of file LogMacros.hpp.

◆ PRECISE_DEBUG

#define PRECISE_DEBUG   Logging::Log::getInstance(true) << _DEBUG_STR << _MY_FILE_GETTER

Debug log with precise details.

Definition at line 153 of file LogMacros.hpp.

◆ PRECISE_ERROR

#define PRECISE_ERROR   Logging::Log::getInstance(false) << _ERROR_STR << _MY_FILE_GETTER

Error log with precise details.

Definition at line 157 of file LogMacros.hpp.

◆ PRECISE_INFO

#define PRECISE_INFO   Logging::Log::getInstance(false) << _INFO_STR << _MY_FILE_GETTER

Info log with precise details.

Definition at line 155 of file LogMacros.hpp.

◆ PRECISE_SUCCESS

#define PRECISE_SUCCESS   Logging::Log::getInstance(false) << _SUCCESS_STR << _MY_FILE_GETTER

Success log with precise details.

Definition at line 154 of file LogMacros.hpp.

◆ PRECISE_WARNING

#define PRECISE_WARNING   Logging::Log::getInstance(false) << _WARNING_STR << _MY_FILE_GETTER

Warning log with precise details.

Definition at line 156 of file LogMacros.hpp.

◆ PRETTY_CRITICAL

Critical log with details and colour.

Definition at line 194 of file LogMacros.hpp.

◆ PRETTY_DEBUG

Debug log with details and colour.

Definition at line 189 of file LogMacros.hpp.

◆ PRETTY_ERROR

Error log with details and colour.

Definition at line 193 of file LogMacros.hpp.

◆ PRETTY_INFO

Info log with details and colour.

Definition at line 191 of file LogMacros.hpp.

◆ PRETTY_SUCCESS

Success log with details and colour.

Definition at line 190 of file LogMacros.hpp.

◆ PRETTY_WARNING

Warning log with details and colour.

Definition at line 192 of file LogMacros.hpp.

◆ RESET_COL

#define RESET_COL   ""

Definition at line 76 of file LogMacros.hpp.

◆ SUCCESS_COL

#define SUCCESS_COL   ""

Definition at line 78 of file LogMacros.hpp.

◆ WARNING_COL

#define WARNING_COL   ""

Definition at line 80 of file LogMacros.hpp.