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

Macros

#define tb_log(formattedMessage, ...)
 
#define tb_log_if(testResult, formattedMessage, ...)
 
#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

#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.
#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[]);
#define tb_log (   formattedMessage,
  ... 
)
Value:
TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << \
TurtleBrains::Core::Formatter(formattedMessage, ##__VA_ARGS__) << TurtleBrains::Core::Debug::EndOfEntry();
Definition: tb_debug_logger.hpp:267
Definition: tb_debug_logger.hpp:273

Writes a message into the log, the message can be a formatted string behaving exactly like printf would. Underneath this simply calls the Debug::CloseLog() 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 tb_configuration.h

Parameters
formattedMessageA string of characters of a formatted string that describes the variable arguments that follow. The formatted message and arguments are used exactly like printf() would be.
...The variable arguments the fill in the formattedMessage string using the same printf() format.
Note
This is now marked for deprecation from future versions of TurtleBrains, use tb_debug_log or tb_always_log instead.
This may be phased out very slowly now that tb_log will use the Formatter() object to log into the stream.
#define tb_log_if (   testResult,
  formattedMessage,
  ... 
)
Value:
if (testResult) { \
TurtleBrains::Core::Debug::TheLogger() << TurtleBrains::Core::Debug::StartOfEntry() << \
TurtleBrains::Core::Formatter(formattedMessage, ##__VA_ARGS__) << TurtleBrains::Core::Debug::EndOfEntry(); }
Definition: tb_debug_logger.hpp:267
Definition: tb_debug_logger.hpp:273

Writes a message into the log, the message can be a formatted string behaving exactly like printf would, but does so only if the testResult is true. If test result is false no message gets displayed on stdout or the log. Underneath this simply calls the Debug::CloseLog() 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 tb_configuration.h

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.
formattedMessageA string of characters of a formatted string that describes the variable arguments that follow. The formatted message and arguments are used exactly like printf() would be.
...The variable arguments the fill in the formattedMessage string using the same printf() format.
Note
This is now marked for deprecation from future versions of TurtleBrains, use tb_debug_log_if or tb_always_log_if instead.
This may be phased out very slowly now that tb_log will use the Formatter() object to log into the stream.