Installation guide

64 DC 900-1325I
Freeway Server-Resident Application (SRA) Programmer Guide
After completing the above commands, when you open the file again with the vi editor,
you will see that the Ctrl-m characters are gone. If you edited the file in the operational
directory, be sure to save the changes by using the menu (5-3-3) or other method.
4.3 Message Logging
The "C" file descriptors stdin, stdout, and stderr can be used (via the standard I/O
library functions
printf, fprintf, etc.) to display information about the health and status
of an SRA. The output of printf calls, for example, will appear on the screen of the user
who started the SRA (whether that user logged in via the serial console, an ssh session,
a telnet session, etc.). However, messages written to the console are transient, and do
not become part of the Freeway message log. Also, if the SRA is started automatically at
boot time (with an rc.startsra command file, for example), then there is no user session
and the printf messages will not appear.
If your SRA needs to log messages that may be retrieved later or if it will be started auto-
matically when the Freeway boots, it can use either the Freeway log or UNIX syslog as
described below.
4.3.1 Freeway Log
Protogate provides the function freeway_log to allow an application to write informa-
tion to both the console port and the log. To use this function, an application must
include the header file
sm.h, and contain the following function declaration:
extern int freeway_log( int, const char*, ... );
The first parameter indicates the type of message being written. The possible values are
LOG_ERROR, LOG_STATUS, LOG_EVENT, or LOG_TRACE. In most cases, only the first two of
these would be used by an application for error messages and status messages, respec-
tively.