2013-06-22 17:58:19 +02:00
|
|
|
/**
|
|
|
|
* Syslog daemon
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009-2013 Freie Universitaet Berlin
|
|
|
|
*
|
|
|
|
* This file subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* @ingroup syslog
|
|
|
|
* @{
|
|
|
|
* @file syslog-api.c
|
|
|
|
* @author Freie Universitaet Berlin
|
|
|
|
* @}
|
|
|
|
*/
|
2013-02-06 13:20:21 +01:00
|
|
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "syslog.h"
|
|
|
|
#include "tracelog.h"
|
|
|
|
|
|
|
|
#undef VSYSLOG
|
|
|
|
#define VSYSLOG(level, strModule, strFmt, argp) vsyslog(level, strModule, strFmt, argp)
|
|
|
|
|
|
|
|
void
|
2013-06-22 05:11:53 +02:00
|
|
|
syslog(const uint8_t level, const char(*const strModule), const char *strFmt, ...)
|
|
|
|
{
|
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(level, strModule, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
#if (SYSLOG_CONF_LEVEL & SL_EMERGENCY) == SL_EMERGENCY
|
2013-06-22 05:11:53 +02:00
|
|
|
void syslog_emergency(const char(*const mod), const char *strFmt, ...)
|
2013-02-06 13:20:21 +01:00
|
|
|
{
|
2013-06-22 05:11:53 +02:00
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(SL_EMERGENCY, mod, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
#if (SYSLOG_CONF_LEVEL & SL_CRITICAL) == SL_CRITICAL
|
2013-06-22 05:11:53 +02:00
|
|
|
void syslog_critical(const char(*const mod), const char *strFmt, ...)
|
2013-02-06 13:20:21 +01:00
|
|
|
{
|
2013-06-22 05:11:53 +02:00
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(SL_CRITICAL, mod, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
#if (SYSLOG_CONF_LEVEL & SL_WARN) == SL_WARN
|
2013-06-22 05:11:53 +02:00
|
|
|
void syslog_warn(const char(*const mod), const char *strFmt, ...)
|
2013-02-06 13:20:21 +01:00
|
|
|
{
|
2013-06-22 05:11:53 +02:00
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(SL_WARN, mod, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
#if (SYSLOG_CONF_LEVEL & SL_NOTICE) == SL_NOTICE
|
2013-06-22 05:11:53 +02:00
|
|
|
void syslog_notice(const char(*const mod), const char *strFmt, ...)
|
2013-02-06 13:20:21 +01:00
|
|
|
{
|
2013-06-22 05:11:53 +02:00
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(SL_NOTICE, mod, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
#if (SYSLOG_CONF_LEVEL & SL_INFO) == SL_INFO
|
2013-06-22 05:11:53 +02:00
|
|
|
void syslog_info(const char(*const mod), const char *strFmt, ...)
|
2013-02-06 13:20:21 +01:00
|
|
|
{
|
2013-06-22 05:11:53 +02:00
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(SL_INFO, mod, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
#if SYSLOG_ISLEVEL(SL_DEBUG)
|
2013-06-22 05:11:53 +02:00
|
|
|
void syslog_debug(const char(*const mod), const char *strFmt, ...)
|
2013-02-06 13:20:21 +01:00
|
|
|
{
|
2013-06-22 05:11:53 +02:00
|
|
|
va_list argp;
|
2013-02-06 13:20:21 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
va_start(argp, strFmt);
|
|
|
|
VSYSLOG(SL_DEBUG, mod, strFmt, argp);
|
|
|
|
va_end(argp);
|
2013-02-06 13:20:21 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|