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

Files

file  afw_log.h
 Adaptive Framework afw_log interface helpers header.
 

Data Structures

struct  afw_log_priority_id_map_entry_s
 

Macros

#define afw_log_release   afw_log_destroy
 
#define AFW_LOG(priority, message, xctx)
 Log an afw_utf8_t message to environment's log. More...
 
#define AFW_LOG_Z(priority, message_z, xctx)
 Log an afw_utf8_z_t message to environment's log. More...
 
#define AFW_LOG_VZ(priority, format_z, ap, xctx)
 Log an message to environment's log using a printf style format and va_list. More...
 
#define AFW_LOG_FZ(priority, xctx, format_z, ...)
 Log an message to environment's log using a printf style format and parameters. More...
 

Typedefs

typedef struct afw_log_priority_id_map_entry_s afw_log_priority_id_map_entry_t
 

Functions

const afw_log_priority_id_map_entry_tafw_log_get_priority_id_map ()
 
afw_log_priority_t afw_log_priority_id_to_priority (const afw_utf8_t *priority_id)
 Convert a log priority id to priority. More...
 
const afw_utf8_tafw_log_priority_to_priority_id (afw_log_priority_t priority)
 Convert a log priority to priority id. More...
 
afw_log_priority_mask_t afw_log_priority_mask (afw_log_priority_t priority)
 Get the priority mask for a log priority. More...
 
afw_log_priority_mask_t afw_log_up_to_priority_mask (afw_log_priority_t priority)
 Get the priority mask for all equal or higher log priorities. More...
 
afw_boolean_t afw_log_priority_in_mask (afw_log_priority_mask_t mask, afw_log_priority_t priority)
 Determined if log priority corresponding bit is on in mask. More...
 
void afw_log_set_priority_in_mask (afw_log_priority_mask_t *mask, afw_log_priority_t priority, afw_boolean_t value)
 Set the corresponding bit for a priority in a mask. More...
 
void afw_log_write_z (const afw_log_t *instance, afw_log_priority_t priority, const afw_utf8_z_t *source_z, const afw_utf8_z_t *message_z, afw_xctx_t *xctx)
 Log an afw_utf8_z_t message. More...
 
void afw_log_write_vz (const afw_log_t *instance, afw_log_priority_t priority, const afw_utf8_z_t *source_z, const afw_utf8_z_t *format_z, va_list ap, afw_xctx_t *xctx)
 Log an message using a printf style format and va_list. More...
 
void afw_log_write_fz (const afw_log_t *instance, afw_log_priority_t priority, const afw_utf8_z_t *source_z, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...)
 Log an message using a printf style format and parameters. More...
 
const afw_log_factory_tafw_log_file_factory_get ()
 Get the factory for log type file. More...
 
const afw_log_factory_tafw_log_standard_factory_get ()
 Get the factory for log type standard. More...
 
void afw_log_add_to_environment (const afw_log_t *instance, afw_xctx_t *xctx)
 Add a log to the list of logs called by environment log. More...
 
void afw_log_set_mask (const afw_log_t *instance, afw_log_priority_mask_t mask, afw_xctx_t *xctx)
 

Detailed Description

Adaptive Framework Log Support.

Log priorities are defined in enum afw_log_priority_t in afw_interface.h. The AFW_LOG macros accept the last part of the enum value name as the priority parameter.

Log priority trace1-8 are not logged, but instead goes to stderr or the configured trace destination.

priority Description
none Priorities will be set individually
emerg System unusable
alert Immediate action required
crit Critical conditions
err Error conditions
warning Warning, errors may occur
notice Normal but significant
info Informational
debug Debug
trace1 Trace level 1 message
trace2 Trace level 2 message
trace3 Trace level 3 message
trace4 Trace level 4 message
trace5 Trace level 5 message
trace6 Trace level 6 message
trace7 Trace level 7 message
trace8 Trace level 8 message

Macro Definition Documentation

◆ AFW_LOG

#define AFW_LOG (   priority,
  message,
  xctx 
)
Value:
afw_log_write(xctx->env->log, afw_log_priority_ ## priority, \
AFW__FILE_LINE__, message, xctx)
#define AFW__FILE_LINE__
file:line
Definition: afw_common.h:148
#define afw_log_write(instance, priority, source_z, message, xctx)
Call method write of interface afw_log.

Log an afw_utf8_t message to environment's log.

Parameters
priorityof message. See table above.
messageto log.
xctxof caller.

Definition at line 158 of file afw_log.h.

◆ AFW_LOG_FZ

#define AFW_LOG_FZ (   priority,
  xctx,
  format_z,
  ... 
)
Value:
afw_log_write_fz(xctx->env->log, afw_log_priority_ ## priority, \
AFW__FILE_LINE__, xctx, format_z, __VA_ARGS__)
void afw_log_write_fz(const afw_log_t *instance, afw_log_priority_t priority, const afw_utf8_z_t *source_z, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...)
Log an message using a printf style format and parameters.
Definition: afw_log.h:249

Log an message to environment's log using a printf style format and parameters.

Parameters
priorityof message. See table above.
xctxof caller.
format_zfor message to log.
...parameters for format.

Definition at line 192 of file afw_log.h.

◆ afw_log_release

#define afw_log_release   afw_log_destroy
Todo:
FIXME: In middle of implementation.

Definition at line 56 of file afw_log.h.

◆ AFW_LOG_VZ

#define AFW_LOG_VZ (   priority,
  format_z,
  ap,
  xctx 
)
Value:
afw_log_write_vz(xctx->env->log, afw_log_priority_ ## priority, \
AFW__FILE_LINE__, format_z, ap, xctx)
void afw_log_write_vz(const afw_log_t *instance, afw_log_priority_t priority, const afw_utf8_z_t *source_z, const afw_utf8_z_t *format_z, va_list ap, afw_xctx_t *xctx)
Log an message using a printf style format and va_list.
Definition: afw_log.c:374

Log an message to environment's log using a printf style format and va_list.

Parameters
priorityof message. See table above.
format_zfor message to log.
apva_list for format.
xctxof caller.

Definition at line 180 of file afw_log.h.

◆ AFW_LOG_Z

#define AFW_LOG_Z (   priority,
  message_z,
  xctx 
)
Value:
afw_log_write_z(xctx->env->log, afw_log_priority_ ## priority, \
AFW__FILE_LINE__, message_z, xctx)
void afw_log_write_z(const afw_log_t *instance, afw_log_priority_t priority, const afw_utf8_z_t *source_z, const afw_utf8_z_t *message_z, afw_xctx_t *xctx)
Log an afw_utf8_z_t message.
Definition: afw_log.h:206

Log an afw_utf8_z_t message to environment's log.

Parameters
priorityof message. See table above.
messageto log.
xctxof caller.

Definition at line 168 of file afw_log.h.

Typedef Documentation

◆ afw_log_priority_id_map_entry_t

priority_id/priority map entry.

Function Documentation

◆ afw_log_add_to_environment()

void afw_log_add_to_environment ( const afw_log_t instance,
afw_xctx_t xctx 
)

Add a log to the list of logs called by environment log.

Parameters
instancelog to add.
xctxof caller.
Todo:
FIXME: Need to use a "log anchor" with id in it.
Todo:
FIXME: runtime object might be accessing on another thread. afw_log_destroy(e->log, xctx);

Definition at line 290 of file afw_log.c.

◆ afw_log_file_factory_get()

const afw_log_factory_t* afw_log_file_factory_get ( )

Get the factory for log type file.

Returns
factory singleton instance.

Definition at line 45 of file afw_log_file.c.

◆ afw_log_get_priority_id_map()

const afw_log_priority_id_map_entry_t* afw_log_get_priority_id_map ( )

Get priority_id/priority map array.

Definition at line 250 of file afw_log.c.

◆ afw_log_priority_id_to_priority()

afw_log_priority_t afw_log_priority_id_to_priority ( const afw_utf8_t priority_id)

Convert a log priority id to priority.

Parameters
idof log priority to convert
Returns
enum corresponding to log priority or -1 if not found.

Definition at line 258 of file afw_log.c.

◆ afw_log_priority_in_mask()

afw_boolean_t afw_log_priority_in_mask ( afw_log_priority_mask_t  mask,
afw_log_priority_t  priority 
)

Determined if log priority corresponding bit is on in mask.

Parameters
maskto check.
priorityto test.
Returns
true or false.

Definition at line 124 of file afw_log.h.

◆ afw_log_priority_mask()

afw_log_priority_mask_t afw_log_priority_mask ( afw_log_priority_t  priority)

Get the priority mask for a log priority.

Parameters
priorityenum to convert
Returns
priority_mask.

Definition at line 99 of file afw_log.h.

◆ afw_log_priority_to_priority_id()

const afw_utf8_t* afw_log_priority_to_priority_id ( afw_log_priority_t  priority)

Convert a log priority to priority id.

Parameters
priorityof log priority enum to convert
Returns
priority_id or NULL if invalid.

Definition at line 273 of file afw_log.c.

◆ afw_log_set_priority_in_mask()

void afw_log_set_priority_in_mask ( afw_log_priority_mask_t mask,
afw_log_priority_t  priority,
afw_boolean_t  value 
)

Set the corresponding bit for a priority in a mask.

Parameters
maskto check.
priorityto test.
valuetrue or false.
Returns
true or false.

Definition at line 138 of file afw_log.h.

◆ afw_log_standard_factory_get()

const afw_log_factory_t* afw_log_standard_factory_get ( )

Get the factory for log type standard.

Returns
factory singleton instance.

Definition at line 45 of file afw_log_standard.c.

◆ afw_log_up_to_priority_mask()

afw_log_priority_mask_t afw_log_up_to_priority_mask ( afw_log_priority_t  priority)

Get the priority mask for all equal or higher log priorities.

Parameters
priorityenum of lowest priority for mask.
Returns
priority_mask.

Definition at line 111 of file afw_log.h.

◆ afw_log_write_fz()

void afw_log_write_fz ( const afw_log_t instance,
afw_log_priority_t  priority,
const afw_utf8_z_t source_z,
afw_xctx_t xctx,
const afw_utf8_z_t format_z,
  ... 
)

Log an message using a printf style format and parameters.

Parameters
instanceof log
priorityafw_log_priority_t
source_zfile:line.
xctxof caller.
format_zfor message to log.
...parameters for format.

Definition at line 249 of file afw_log.h.

◆ afw_log_write_vz()

void afw_log_write_vz ( const afw_log_t instance,
afw_log_priority_t  priority,
const afw_utf8_z_t source_z,
const afw_utf8_z_t format_z,
va_list  ap,
afw_xctx_t xctx 
)

Log an message using a printf style format and va_list.

Parameters
instanceof log
priorityafw_log_priority_t
source_zfile:line.
format_zfor message to log.
apva_list for format.
xctxof caller.

Definition at line 374 of file afw_log.c.

◆ afw_log_write_z()

void afw_log_write_z ( const afw_log_t instance,
afw_log_priority_t  priority,
const afw_utf8_z_t source_z,
const afw_utf8_z_t message_z,
afw_xctx_t xctx 
)

Log an afw_utf8_z_t message.

Parameters
instanceof log
priorityafw_log_priority_t
source_zfile:line.
message_zmessage to log.
xctxof caller.

Definition at line 206 of file afw_log.h.