TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
Debug Log Macros

Macros

#define tb_debug_log(log_stream)   TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry();
 
#define tb_debug_log_if(testResult, log_stream)   if (testResult) { TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry(); }
 
#define tb_debug_hexdump(message, rawData, dataSize)   TurtleBrains::Core::Debug::LogHexDump(message, rawData, dataSize)
 
#define tb_always_log(log_stream)   TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry();
 
#define tb_always_log_if(testResult, log_stream)   if (testResult) { TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry(); }
 
#define tb_always_hexdump(message, rawData, dataSize)   TurtleBrains::Core::Debug::LogHexDump(message, rawData, dataSize)
 
#define tb_debug_project_entry_point(entryPoint)   TurtleBrains::Core::Debug::ProjectEntryPoint(entryPoint);
 
#define tb_debug_project_entry_point_with(entryPoint, argumentCount, argumentValues)    TurtleBrains::Core::Debug::ProjectEntryPoint(entryPoint, argumentCount, argumentValues);
 

Detailed Description

Macro Definition Documentation

◆ tb_always_hexdump

#define tb_always_hexdump (   message,
  rawData,
  dataSize 
)    TurtleBrains::Core::Debug::LogHexDump(message, rawData, dataSize)

Show the raw bytes as hexvalues directly in a log with a message that introduces what is being displayed. Implementation simply calls Debug::LogHexDump().

Parameters
messageA quick string preceding the hexdump that can be used to understand the data.
rawDataThe address of the data to dump into the log.
dataSizeHow much data, in bytes, should get displayed.
Note
tb_always_hexdump should only be used when the messaging is important enough to be publicly facing. Watch out for secrets in the data being dumped!

◆ tb_always_log

#define tb_always_log (   log_stream)    TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry();

Writes a message into the log using a stream and anything that overloads operator<<(ofstream&) should be able to be shoved through. One would typically log to a specific channel and set the logging level using tb_debug_log(LogGameplay::Info() << "Hello Turtles!"); to log on the "Gameplay" channel at Info level. Implementation simply calls the Debug::TheLogger() with start/end entry, however the define is simpler.

Parameters
log_streamAny combination of objects that support operator<<ofstream&) typically starting with the the LogChannel and LogLevel like; tb_debug_log(LogGameplay::Info() << "Hello Turtles!");
Note
tb_always_log_if should only be used when the messaging is important enough to be publicly facing. Typically for errors, warnings and info that is critical for dianostics.

◆ tb_always_log_if

#define tb_always_log_if (   testResult,
  log_stream 
)    if (testResult) { TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry(); }

Checks if the testResult is true and only when that is true will this write a message to the log exactly as tb_debug_log would.

Parameters
testResultAn expression that will result in a boolean, true or false, result. If true the message will output in the log and stdout, otherwise it will not be displayed.
log_streamAny combination of objects that support operator<<ofstream&) typically starting with the the LogChannel and LogLevel like; tb_debug_log(LogGameplay::Info() << "Hello Turtles!");
Note
tb_always_log_if should only be used when the messaging is important enough to be publicly facing. Typically for errors, warnings and info that is critical for dianostics.

◆ tb_debug_hexdump

#define tb_debug_hexdump (   message,
  rawData,
  dataSize 
)    TurtleBrains::Core::Debug::LogHexDump(message, rawData, dataSize)

Show the raw bytes as hexvalues directly in a log with a message that introduces what is being displayed. Implementation simply calls Debug::LogHexDump() but the define should be preferred as it will be disabled in public builds when tb_without_debug_set is defined in tb_configuration.h

Parameters
messageA quick string preceding the hexdump that can be used to understand the data.
rawDataThe address of the data to dump into the log.
dataSizeHow much data, in bytes, should get displayed.
Note
Watch out for secrets in the data being dumped!

◆ tb_debug_log

#define tb_debug_log (   log_stream)    TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry();

Writes a message into the log using a stream and anything that overloads operator<<(ofstream&) should be able to be shoved through. One would typically log to a specific channel and set the logging level using tb_debug_log(LogGameplay::Info() << "Hello Turtles!"); to log on the "Gameplay" channel at Info level. Implementation simply calls the Debug::TheLogger() with start/end entry, however the define should be preferred because it will disable all logging with the tb_without_debug_set defined in tb_configuration.h

Parameters
log_streamAny combination of objects that support operator<<ofstream&) typically starting with the the LogChannel and LogLevel like; tb_debug_log(LogGameplay::Info() << "Hello Turtles!");

◆ tb_debug_log_if

#define tb_debug_log_if (   testResult,
  log_stream 
)    if (testResult) { TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << log_stream << TurtleBrains::Core::Debug::EndOfEntry(); }

Checks if the testResult is true and only when that is true will this write a message to the log exactly as tb_debug_log would.

Parameters
testResultAn expression that will result in a boolean, true or false, result. If true the message will output in the log and stdout, otherwise it will not be displayed.
log_streamAny combination of objects that support operator<<ofstream&) typically starting with the the LogChannel and LogLevel like; tb_debug_log(LogGameplay::Info() << "Hello Turtles!");

◆ tb_debug_project_entry_point

#define tb_debug_project_entry_point (   entryPoint)    TurtleBrains::Core::Debug::ProjectEntryPoint(entryPoint);

Setups a special exception handler on Windows built with Visual CPP that will create a crash report with a callstack when an exception is thrown and caught within. For other platforms and compilers the exception will be caught but no crash report will be created as far as TurlteBrains v0.2.0. Hopeful future support.

Underneath this simply calls the Debug::ProjectEntryPoint() function, however the define should be preferred when you want to have the option of turning off all logging with the tb_without_debug_set define in the tb_configuration.h file.

Parameters
entryPointA function pointer to a function that takes no parameters and returns no parameters, void foo(void); that will be called after setting up an exception handler to create a crash report.

◆ tb_debug_project_entry_point_with

#define tb_debug_project_entry_point_with (   entryPoint,
  argumentCount,
  argumentValues 
)     TurtleBrains::Core::Debug::ProjectEntryPoint(entryPoint, argumentCount, argumentValues);

Setups a special exception handler on Windows built with Visual CPP that will create a crash report with a callstack when an exception is thrown and caught within. For other platforms and compilers the exception will be caught but no crash report will be created as far as TurlteBrains v0.2.0. Hopeful future support.

Underneath this simply calls the Debug::ProjectEntryPoint() function, however the define should be preferred when you want to have the option of turning off all logging with the tb_without_debug_set define in the tb_configuration.h file.

Parameters
entryPointA function pointer to a function that takes an argumentCount and values parameters just like the would be passed to a main and returns an int: int foo(int c, char* v[]); that will be called after setting up an exception handler to create a crash report.
argumentCountThe number of values in the argumentValues array, typically just pass the same argumentCount you would get from main(int c, char* v[]);
argumentValuesThe actual values of each argument as null-terminated strings, typically just pass the same argumentValues you would get from main(int c, char* v[]);