Standard C Library Functions vsyslog(3C)
NAME
vsyslog - log message with a stdarg argument list
SYNOPSIS
#include
#include
void vsyslog(int priority, const char *message, valist ap);
DESCRIPTION
The vsyslog() function is identical to syslog(3C), except
that it is called with an argument list as defined by
rather than with a variable number of arguments.
EXAMPLES
Example 1 Use vsyslog() to write an error routine.
The following example demonstrates the use of vsyslog() in
writing an error routine.
#include
#include
/*
* error should be called like:
* error(pri, functionname, format, arg1, arg2...);
*/
void
error(int pri, char *functionname, char *format, ...)
{
valist args;
vastart(args, format);
/* log name of function causing error */
(void) syslog(pri, "EROR in %s.", functionname);
/* log remainder of message */
(void) vsyslog(pri, format, args);
vaend(args);
(void) abort( );
}
main()
{
error(LOGER, "main", "process %d is dying", getpid());
}
SunOS 5.11 Last change: 30 Aug 2006 1
Standard C Library Functions vsyslog(3C)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level Safe
SEE ALSO
syslog(3C), attributes(5)
SunOS 5.11 Last change: 30 Aug 2006 2
|