Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Macros | Functions

Files

file  afw_trace.h
 Adaptive Framework Software Trace Header.
 

Macros

#define AFW_TRACE_STATIC_TRACE_ID(label, trace_id)
 Define a static trace_id rti. More...
 
#define afw_trace(trace_level, flag_index, instance, message, xctx)
 If applicable, write trace. More...
 
#define afw_trace_fz(trace_level, flag_index, instance, xctx, format_z, ...)
 If applicable, write trace using a printf style format. More...
 
#define afw_trace_vz(trace_level, flag_index, instance, format_z, ap, xctx)
 If applicable, write trace using a printf style format and va_list. More...
 
#define afw_trace_z(trace_level, flag_index, instance, message_z, xctx)
 If applicable, write trace from zero terminate string. More...
 

Functions

void afw_trace_write (afw_log_priority_t priority, const afw_interface_implementation_rti_t *rti, const afw_utf8_z_t *source_z, const afw_utf8_t *message, afw_xctx_t *xctx)
 Write trace. More...
 
void afw_trace_write_fz (afw_log_priority_t priority, const afw_interface_implementation_rti_t *rti, const afw_utf8_z_t *source_z, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...)
 Write trace using a printf style format. More...
 
void afw_trace_write_vz (afw_log_priority_t priority, const afw_interface_implementation_rti_t *rti, const afw_utf8_z_t *source_z, const afw_utf8_z_t *format_z, va_list ap, afw_xctx_t *xctx)
 Write trace using a printf style format and va_list. More...
 
void afw_trace_write_z (afw_log_priority_t priority, const afw_interface_implementation_rti_t *rti, const afw_utf8_z_t *source_z, const afw_utf8_z_t *message_z, afw_xctx_t *xctx)
 Write trace from zero terminate string. More...
 

Detailed Description

These macros and functions assist writing trace message to the environment log. All trace message have associated runtime information (rti) that can be used for prefixing messages as well as filtering. The first parameter of macros AFW_TRACE(), AFW_TRACE_Z(), AFW_TRACE_FZ(), and AFW_TRACE_VZ() is a instance, which is used to locate the implementation rti. The AFW_TRACE_WRITE*() macros and afw_trace_write*() functions have rti as the first parameter.

All trace message are written to the environment log. See afw_log.h for more information.

Macro Definition Documentation

◆ afw_trace

#define afw_trace (   trace_level,
  flag_index,
  instance,
  message,
  xctx 
)
Value:
if ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index]) \
afw_trace_write( \
afw_log_priority_trace##trace_level, \
((instance) ? \
&((const afw_instance_t *)instance)->inf->rti \
: NULL), \
AFW__FILE_LINE__, message, xctx)
#define AFW__FILE_LINE__
file:line
Definition: afw_common.h:148
Minimal Instance.

If applicable, write trace.

Parameters
trace_levelis a literal 1 - 8 added to "trace" to form log level.
flag_indexof flag to check to determine if trace is applicable.
instanceassociated with trace message.
messageto log.
xctxof caller.

The trace_level 1 is the most commonly used level in Adaptive Framework. Use 2 - 8 when a particular trace benefits from a different log priority. For example, 2 - 8 could indicate more detail for a particular flag.

Definition at line 65 of file afw_trace.h.

◆ afw_trace_fz

#define afw_trace_fz (   trace_level,
  flag_index,
  instance,
  xctx,
  format_z,
  ... 
)
Value:
if ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index]) \
afw_trace_write_fz( \
afw_log_priority_trace##trace_level, \
((instance) ? \
&((const afw_instance_t *)instance)->inf->rti \
: NULL), \
AFW__FILE_LINE__, xctx, format_z, __VA_ARGS__)

If applicable, write trace using a printf style format.

Parameters
trace_levelis a literal 1 - 8 added to "trace" to form log level.
flag_indexof flag to check to determine if trace is applicable.
instanceassociated with trace message.
xctxof caller.
format_zfor message to log.
...parameters for format.

The trace_level 1 is the most commonly used level in Adaptive Framework. Use 2 - 8 when a particular trace benefits from a different log priority. For example, 2 - 8 could indicate more detail for a particular flag.

Definition at line 88 of file afw_trace.h.

◆ AFW_TRACE_STATIC_TRACE_ID

#define AFW_TRACE_STATIC_TRACE_ID (   label,
  trace_id 
)
Value:
static const afw_interface_implementation_rti_t label = \
{"afw_trace_id", __FILE__, trace_id};
Interface Implementation Run Time Information.

Define a static trace_id rti.

Parameters
labelfor the static trace_id rti.
trace_idThe first parameter of afw_trace_write*() functions and AFW_TRACE_WRITE*() macros is an rti. This macro defines a static rti that can be passed to these for non-interface tracing.

Definition at line 48 of file afw_trace.h.

◆ afw_trace_vz

#define afw_trace_vz (   trace_level,
  flag_index,
  instance,
  format_z,
  ap,
  xctx 
)
Value:
if ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index]) \
afw_trace_write_vz( \
afw_log_priority_trace##trace_level, \
((instance) ? \
&((const afw_instance_t *)instance)->inf->rti \
: NULL), \
AFW__FILE_LINE__, format_z, ap, xctx)

If applicable, write trace using a printf style format and va_list.

Parameters
trace_levelis a literal 1 - 8 added to "trace" to form log level.
flag_indexof flag to check to determine if trace is applicable.
instanceassociated with trace message.
format_zfor message to log.
apva_list for format.
xctxof caller.

The trace_level 1 is the most commonly used level in Adaptive Framework. Use 2 - 8 when a particular trace benefits from a different log priority. For example, 2 - 8 could indicate more detail for a particular flag.

Definition at line 111 of file afw_trace.h.

◆ afw_trace_z

#define afw_trace_z (   trace_level,
  flag_index,
  instance,
  message_z,
  xctx 
)
Value:
if ((flag_index) < (xctx)->flags_count && (xctx)->flags[flag_index]) \
afw_trace_write_z( \
afw_log_priority_trace##trace_level, \
((instance) ? \
&((const afw_instance_t *)instance)->inf->rti \
: NULL), \
AFW__FILE_LINE__, message_z, xctx)

If applicable, write trace from zero terminate string.

Parameters
trace_levelis a literal 1 - 8 added to "trace" to form log level.
flag_indexof flag to check to determine if trace is applicable.
instanceassociated with trace message.
message_zto log.
xctxof caller.

The trace_level 1 is the most commonly used level in Adaptive Framework. Use 2 - 8 when a particular trace benefits from a different log priority. For example, 2 - 8 could indicate more detail for a particular flag.

Definition at line 133 of file afw_trace.h.

Function Documentation

◆ afw_trace_write()

void afw_trace_write ( afw_log_priority_t  priority,
const afw_interface_implementation_rti_t rti,
const afw_utf8_z_t source_z,
const afw_utf8_t message,
afw_xctx_t xctx 
)

Write trace.

Parameters
priorityis log priority for log message (afw_log_priority_t)
rtiassociated with trace message.
source_zfile:line.
messageto log.
xctxof caller.

Normally afw_trace() should be called instead.

Definition at line 21 of file afw_trace.c.

◆ afw_trace_write_fz()

void afw_trace_write_fz ( afw_log_priority_t  priority,
const afw_interface_implementation_rti_t rti,
const afw_utf8_z_t source_z,
afw_xctx_t xctx,
const afw_utf8_z_t format_z,
  ... 
)

Write trace using a printf style format.

Parameters
priorityis log priority for log message (afw_log_priority_t)
rtiassociated with trace message.
source_zfile:line.
xctxof caller.
format_zfor message to log.
...parameters for format.

Normally afw_trace_fz() should be called instead.

Definition at line 45 of file afw_trace.c.

◆ afw_trace_write_vz()

void afw_trace_write_vz ( afw_log_priority_t  priority,
const afw_interface_implementation_rti_t rti,
const afw_utf8_z_t source_z,
const afw_utf8_z_t format_z,
va_list  ap,
afw_xctx_t xctx 
)

Write trace using a printf style format and va_list.

Parameters
priorityis log priority for log message (afw_log_priority_t)
rtiassociated with trace message.
source_zfile:line.
format_zfor message to log.
apva_list for format.
xctxof caller.

Normally afw_trace_vz() should be called instead.

Definition at line 65 of file afw_trace.c.

◆ afw_trace_write_z()

void afw_trace_write_z ( afw_log_priority_t  priority,
const afw_interface_implementation_rti_t rti,
const afw_utf8_z_t source_z,
const afw_utf8_z_t message_z,
afw_xctx_t xctx 
)

Write trace from zero terminate string.

Parameters
priorityis log priority for log message (afw_log_priority_t)
rtiassociated with trace message.
source_zfile:line.
message_zto log.
xctxof caller.

Normally afw_trace_z() should be called instead.

Definition at line 81 of file afw_trace.c.