|
#include <syslog.h>
#include <stdarg.h>
/*
* error should be called like:
* error(pri, function_name, format, arg1, arg2...);
*/
void
error(int pri, char *function_name, char *format, ...)
{
va_list args;
va_start(args, format);
/* log name of function causing error */
(void) syslog(pri, "ERROR in %s.", function_name);
/* log remainder of message */
(void) vsyslog(pri, format, args);
va_end(args);
(void) abort( );
}
main()
{
error(LOG_ERR, "main", "process %d is dying", getpid());
}
|