yahelpers
Enhanced debugging functionality for the ya ecosystem
Loading...
Searching...
No Matches
Macros
Logging macros

Macros for debugging and tracing. More...

Macros

#define LOG_DEBUG(formatted_string, ...)
 Prints a debug message.
 
#define LOG_FUNCTION_CALL(fn_name)   LOG_DEBUG(#fn_name " was called.\n");
 Prints a function call.
 
#define LOG_FUNCTION_BACK(fn_name)   LOG_DEBUG("Back in " #fn_name "\n");
 Prints a return to a function.
 
#define TYPE_CALL_ADDRESS   0
 Specifies that the given parameter is a pointer.
 
#define TYPE_CALL_VALUE   1
 Specifies that the given parameter is a value.
 
#define TCA   TYPE_CALL_ADDRESS
 Alias for TYPE_CALL_ADDRESS.
 
#define TCV   TYPE_CALL_VALUE
 Alias for TYPE_CALL_VALUE.
 
#define LOG_PARAMETER(ordinal_number, type, type_call, fmt, ...)
 Prints a parameter of a function.
 
#define LOG_RETURN(type, type_call, fmt, ...)
 Prints the value or address that a function will return.
 

Detailed Description

Macros for debugging and tracing.

Macro Definition Documentation

◆ LOG_DEBUG

#define LOG_DEBUG (   formatted_string,
  ... 
)
Value:
do { \
printf("\e[0;32m" DEBUG "( " __FILE__ ": " TOSTRING(__LINE__) " )" \
"\e[0m" \
" " formatted_string, \
##__VA_ARGS__); \
} while (0)
#define TOSTRING(x)
Definition log.h:36
#define DEBUG
Definition logconstants.h:10

Prints a debug message.

Parameters
formatted_stringThe string which specifies what is outputted

◆ LOG_FUNCTION_BACK

#define LOG_FUNCTION_BACK (   fn_name)    LOG_DEBUG("Back in " #fn_name "\n");

Prints a return to a function.

Parameters
fn_nameThe name of the function were the program is now.

◆ LOG_FUNCTION_CALL

#define LOG_FUNCTION_CALL (   fn_name)    LOG_DEBUG(#fn_name " was called.\n");

Prints a function call.

Parameters
fn_nameThe name of the function that was called.

◆ LOG_PARAMETER

#define LOG_PARAMETER (   ordinal_number,
  type,
  type_call,
  fmt,
  ... 
)
Value:
LOG_DEBUG(#ordinal_number " parameter (type: " #type ") with %s " fmt, \
(type_call == TYPE_CALL_ADDRESS ? "address" : "value"), ##__VA_ARGS__)
#define LOG_DEBUG(formatted_string,...)
Prints a debug message.
Definition log.h:46
#define TYPE_CALL_ADDRESS
Specifies that the given parameter is a pointer.
Definition log.h:67

Prints a parameter of a function.

Parameters
ordinal_numberThe number of the parameter (e.g. 1st, 2nd, ...)
typeThe type of the parameter (e.g. int, char, double, ...)
type_callSpecifies whether the parameter is a pointer or a value
fmtMakes additional information possible
See also
TCA
TCV
TYPE_CALL_ADDRESS
TYPE_CALL_VALUE

◆ LOG_RETURN

#define LOG_RETURN (   type,
  type_call,
  fmt,
  ... 
)
Value:
LOG_DEBUG("Returning (type: " #type ") %s " fmt, (type_call == TYPE_CALL_ADDRESS ? "address" : "value"), \
##__VA_ARGS__)

Prints the value or address that a function will return.

Parameters
typeThe type of the return value (e.g. int, char, double, ...)
type_callSpecifies whether the return value is a pointer or a value
fmtMakes additional information possible
See also
TCA
TCV
TYPE_CALL_ADDRESS
TYPE_CALL_VALUE

◆ TCA

#define TCA   TYPE_CALL_ADDRESS

Alias for TYPE_CALL_ADDRESS.

◆ TCV

#define TCV   TYPE_CALL_VALUE

Alias for TYPE_CALL_VALUE.

◆ TYPE_CALL_ADDRESS

#define TYPE_CALL_ADDRESS   0

Specifies that the given parameter is a pointer.

See also
LOG_PARAMETER

◆ TYPE_CALL_VALUE

#define TYPE_CALL_VALUE   1

Specifies that the given parameter is a value.

See also
LOG_PARAMETER