LOGWRITE(3A) LOGWRITE(3A)
NAME
LogWrite, LogSystemError, LogDebug, LogAssert - write a
message to the log file
SYNOPSIS
#include <Atari/log.h>
LogWrite (fmt, arg ...)
char *fmt;
LogSystemError (fmt, arg ...)
char *fmt;
LogDebug (level,(fmt, arg ...))
LogAssert (level,condition,(fmt, arg ...))
DESCRIPTION
LogWrite writes the string to the log file. It processes a
printf(3)-style format string with arguments. It tries to
put the date and time at the beginning of each line. It
uses the last character in the format string to decide if it
has reached the end of a line or not, so if the format
string ends in ""%s"", a newline could be emitted that would
not be detected by LogWrite.
LogSystemError reports a system error, the type that sets
the global variable errno. Unlike perror(3), this accepts
printf-style arguments. If previous calls to LogWrite have
not produced an end of line, one is added. Then the date
and time are emitted, followed by the formatted text. The
text should not contain a new line, since it is followed by
a colon, then the standard system error message, such as
that presented by perror. The message is terminated with a
period and newline.
LogDebug is a macro defined in the include file
<Atari/log.h>. It checks level against the constant
LOGLEVEL, and if the level is less than or equal to
Page 1 (printed 9/3/91)
LOGWRITE(3A) LOGWRITE(3A)
LOGLEVEL, generates a call to LogWrite. If the level is
greater than LOGLEVEL, no code is generated at all. Thus,
one can place debug messages in code at various level, and
only those requested by LOGLEVEL will be compiled in. In
<Atari/log.h>, LOGLEVEL is set to zero if not already
defined.
Note that there is an extra set of parentheses to the
parameters to LogWrite, since traditional cpp's cannot
handle a variable number of parameters in their macros.
LogAssert macros tests an assertion. If level is less than
or equal to the current LOGLEVEL, it tests the given
condition. If the condition is false, it makes a call to
LogWrite. As with LogDebug, this macro has extra
parentheses around the printf-style arguments.
SEE ALSO
LogOpen(3A)
Page 2 (printed 9/3/91)