ACC Utilities Reference Guide

Chapter 7 185
ZMLOG - Diagnostic Message Logging
ZCOM Diagnostic Message Logging Mechanism
The following example illustrates how a program may use these calls:
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h>
long message_number,error_number,numb_vars;
long var_descriptor,var_value;
/* During program initialization setup the program name - max 5 chars */
zcomlname (”progx”);
...
/* Set the error number - max 5 digits */
error_number=123;
/* Set the text message number - see example message file*/
message_number = 3;
/* Set number variables to be passed with message - list to follow */
numb_vars = 1;
/* Set variable type and value - See Application Data Types and Macros*/
var_descriptor = ZCOM_AT_INT; /* for integer */
var_value = 5;
/* Send the message to the ZCOM log */
zcomlog (error_number, message_number, numb_vars,
var_descriptor,var_value);
This call will generate the following error message:
10:43:32 progx 00123 2 Test Error Message on Channel 5
If the error message is read by a user supplied application from
/dev/zmlog, then it is the responsibility of that application to expand the
binary message into a displayable form. For interpretation of the binary
error log information, see the ZMLOG Format Description section.
It is also the responsibility of the application program that is generating
the error messages to ensure that the messages cannot be confused with
other messages from different sources. The easiest way to ensure this is
to choose a unique 5 character program name.