/******************************************************************************
* This file is part of a software distribution, which is furnished under the *
* terms of a license. Use of this software by any means is subject to this *
* license and signifies the acceptance of the licensing terms stated *
* therein. Please see the file LICENSE in the top-level directory of this *
* software distribution for detailed copyright disclaimers and licensing *
* terms. *
******************************************************************************
* Copryight (c) by Andreas S. Wetzel - All rights reserved. *
******************************************************************************/
/* $Id: vd_log.c,v 1.2 2001/03/19 14:54:05 mickey Exp $ */
#include <vchat.h>
#include <proto_vchatd.h>
#if HAVE_SYSLOG_H
# include <syslog.h>
#endif
/*** Globals ***/
extern VP vp;
extern VD vd;
/*** Code ***/
void log(int priority, char *fmt, ...)
{
va_list ap;
char logline[8192];
va_start(ap,fmt);
switch(vd.logswitch)
{
case 0: break;
case 1: vsprintf(logline, fmt, ap);
fprintf(vp.logfl, "[pid:%ld] %s\n", vd.my_pid, logline);
fflush(vp.logfl);
break;
case 2:
#if HAVE_SYSLOG_H
vsprintf(logline, fmt, ap);
syslog(priority, "[pid:%ld] %s", vd.my_pid, logline);
#endif
break;
}
va_end(ap);
}
syntax highlighted by Code2HTML, v. 0.9.1