CallLogger_t Class Reference

Class which logs calls into, status in, and results returned by a set of functions. More...

#include <UTCallLogger.h>

List of all members.

Public Member Functions

 CallLogger_t (bool include_caller_info, int skip_caller_frames=0, bool show_timestamps_ms=false, int delay_ms_after_each_print=0)
 ~CallLogger_t ()
void EnterFunction (stringliteral *name, stringliteral *format,...)
void EnterFunctionV (stringliteral *name, stringliteral *format, va_list args)
void LogStatus (int line, const Status_t &status)
void LogStatus (int line, stringliteral *format,...)
void LogStatusV (int line, stringliteral *format, va_list args)
void LogStatusStart (int line, stringliteral *format,...)
void LogStatusStartV (int line, stringliteral *format, va_list args)
void LogStatusBuffer (const byte *buffer, int length, int max_end_lengths)
void LogStatusFinish (stringliteral *format,...)
void LogStatusFinishV (stringliteral *format, va_list args)
void ExitFunction (int line)
void ExitFunction (int line, const Status_t &status)
void ExitFunction (int line, stringliteral *format,...)
void ExitFunctionV (int line, stringliteral *format, va_list args)

Detailed Description

Class which logs calls into, status in, and results returned by a set of functions to rel_debug_printf. Any given CallLogger_t instance may only be used from a single thread. For multithreaded call logging, a separate instance must be instantiated for each thread. Separate instances can be created in separate threads, or even separate bodies of functionality in the same thread.

Definition at line 36 of file UTCallLogger.h.


Constructor & Destructor Documentation

CallLogger_t::CallLogger_t ( bool  include_caller_info,
int  skip_caller_frames = 0,
bool  show_timestamps_ms = false,
int  delay_ms_after_each_print = 0 
) [inline]

Constructor for a call logger. If include_caller_info is true, whenever entry into a function by way of EnterFunction or EnterFunctionV is logged, the place from which the function was called will also be logged if symbols are available for the module from which it was called. If the object being traced uses a layer between where the tracing is relevant and entering EnterFunction or EnterFunctionV (for example to filter what is to be logged for a specific instance under test), then skip_caller_frames should be set to 1 or more, depending on the number of layers between the implementation being traced and entry into any of the logging functions. See the IOStream_t LOG_FILE_OPS functions for an example.

Definition at line 174 of file UTCallLogger.h.

CallLogger_t::~CallLogger_t (  )  [inline]

Destructor for a call logger. All calls logged by EnterFunction or one of its variants must have been matched with a call to ExitFunction or one of its variants.

Definition at line 188 of file UTCallLogger.h.


Member Function Documentation

void CallLogger_t::EnterFunction ( stringliteral name,
stringliteral format,
  ... 
)

Logs entry into the current function and if include_caller_info was specified, where it was called from if that info is available. The format string may be NULL. If it is non-null, it is a printf-style format string followed by optional variable arguments to be printed. All points of return from the function must be preceded by a call to one of the ExitFunction variants, or the call depth will become imbalanced and an assertion failure will eventually result.

void CallLogger_t::EnterFunctionV ( stringliteral name,
stringliteral format,
va_list  args 
)

Logs entry into the current function and if include_caller_info was specified, where it was called from if that info is available. The format string may be NULL. If it is non-null, it is a vprintf-style format string followed by variable arguments to be printed. All points of return from the function must be preceded by a call to one of the ExitFunction variants, or the call depth will become imbalanced and an assertion failure will eventually result.

void CallLogger_t::LogStatus ( int  line,
const Status_t status 
)

Logs a status snapshot in the current function.

void CallLogger_t::LogStatus ( int  line,
stringliteral format,
  ... 
)

Logs a state snapshot in the current function using a printf-style format string and optional variable arguments to be printed.

void CallLogger_t::LogStatusV ( int  line,
stringliteral format,
va_list  args 
)

Logs a state snapshot in the current function using a vprintf-style format string and optional variable arguments to be printed.

void CallLogger_t::LogStatusStart ( int  line,
stringliteral format,
  ... 
)

Logs a status snapshot in the current function using a printf-style format string and optional variable arguments to be printed, but does not output it to debug_printf until LogStatusFinish is called. Neither LogStatus nor ExitFunction may be called until LogStatusFinish has been called. Given that restriction, this is typically only useful to be followed by LogStatusBuffer then LogStatusFinish or LogStatusFinishV.

void CallLogger_t::LogStatusStartV ( int  line,
stringliteral format,
va_list  args 
)

Logs a status snapshot in the current function using a vprintf-style format string and optional variable arguments to be printed, but does not output it to debug_printf until LogStatusFinish is called. Neither LogStatus nor ExitFunction may be called until LogStatusFinish has been called. Given that restriction, this is typically only useful to be followed by LogStatusBuffer then LogStatusFinish or LogStatusFinishV.

void CallLogger_t::LogStatusBuffer ( const byte buffer,
int  length,
int  max_end_lengths 
)

Logs a status snapshot in the current function, but does not output it to debug_printf until LogStatusFinish is called. LogStatusStart must have been called first, this simply prints the contents of a buffer into the accumulating log string to be printed when LogStatusFinish is called. If the length is greater than double max_end_lengths, max_end_lengths bytes at the beginning and ending of the buffer will be printed, separated by "..".

void CallLogger_t::LogStatusFinish ( stringliteral format,
  ... 
)

Completes cached output from LogStatusStart and LogStatusBuffer and prints it using debug_printf. The format string may be NULL, but if not, is a printf-style format string and optional variable arguments to be printed.

void CallLogger_t::LogStatusFinishV ( stringliteral format,
va_list  args 
)

Completes cached output from LogStatusStart and LogStatusBuffer and prints it using debug_printf. The format string may be NULL, but if not, is a vprintf-style format string and optional variable arguments to be printed.

void CallLogger_t::ExitFunction ( int  line  ) 

Logs the completion of the current function.

void CallLogger_t::ExitFunction ( int  line,
const Status_t status 
)

Logs the completion of the current function, printing the specified status which should represent a return value.

void CallLogger_t::ExitFunction ( int  line,
stringliteral format,
  ... 
)

Logs the completion of the current function with a printf-style format string and optional variable arguments to be printed.

void CallLogger_t::ExitFunctionV ( int  line,
stringliteral format,
va_list  args 
)

Logs the completion of the current function with a printf-style format string and optional variable arguments to be printed.


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

Generated on Tue Dec 14 22:35:06 2010 for UT library by  doxygen 1.6.1