next up previous contents
Next: Trace Module (TM_) Up: OPEN C PLATFORM Previous: Exception Handling (EH_)   Contents

Subsections

Log Module (LOG_)

#include "log.h"


Void
LOG_init(void);

SuccFail
LOG_config(Char *tmFileName);

log_ModInfo *
LOG_open(Char *moduleName);

SuccFail
LOG_event(Char *format, ...);

Bool
LOG_modEvent(log_ModInfo *modInfo,  Char *format, ...);

The Log Module (LOG_) generates log messages in order to facilitate program monitoring. Within OCP, each module may have its own particular degree of LOG_ tracing enabled at run-time. Developers may also use LOG_ tracing within applications in a similar manner.

Use of the Log Module has several advantages over other traditional tracing methods such as printf() statements:

  1. Log messages have a consistent appearance.
  2. Log calls need ever be removed from the code.
  3. The log module output can be routed to selected devices or files.

Loging may also be globally enabled or disabled at compile time without performing any changes to the source code, other than changing the value of a defined value in a single include file.

Log Module Initialization

Void
LOG_init()


SuccFail
LOG_config(char *pFileName)

Global initialization of LOG_ is performed by LOG_init(), which should be called once at the start of a user program and prior to any other LOG_ facilites. LOG_Init() creates two queues of log module information - an active queue and a setup queue. All information about LOG_ users is entered in these queues.

Use LOG_config() to redirect LOG_ output to a device or file other than stdout.

LOG_ User Initialization

Void
LOG_OPEN(log_ModInfo *hModCB, char *modName)

LOG_open() creates a new log module information entry in the active queue. modName is assigned to the entry's module name member. It's bit mask setting is determined by the state of the setup queue. If there exists an entry in the setup queue with the same module name (typically made by a call to LOG_SETUP), then the mask is taken from that queue. Otherwise the mask is set to zero (loging disabled).

LOG_open() returns a pointer to the new entry in the active queue in hModCB.

Log Message Display

LOG_event(args)

Log messages are generated by the LOG_event() facility, which accepts an argument list string and a variable number of associated arguments.


next up previous contents
Next: Trace Module (TM_) Up: OPEN C PLATFORM Previous: Exception Handling (EH_)   Contents