2014-07-11 22:12:11 +02:00
|
|
|
/*
|
|
|
|
This file is part of libcapwap.
|
|
|
|
|
|
|
|
libcapwap is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
libcapwap is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
*/
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2018-03-19 17:26:01 +01:00
|
|
|
|
2015-03-15 20:53:21 +01:00
|
|
|
/**
|
|
|
|
*@file
|
|
|
|
*@brief Definitions for logging and debugging.
|
|
|
|
*/
|
|
|
|
|
2018-03-25 11:14:37 +02:00
|
|
|
/**
|
|
|
|
* @defgroup LOGDBG Logging & Debugging
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
#ifndef __CW_LOG_H
|
|
|
|
#define __CW_LOG_H
|
|
|
|
|
2018-03-31 18:40:45 +02:00
|
|
|
#include <syslog.h>
|
2014-07-11 22:12:11 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
#ifndef LOG_ERROR
|
|
|
|
#define LOG_ERROR LOG_ERR
|
|
|
|
#endif
|
|
|
|
|
2018-03-05 07:18:02 +01:00
|
|
|
struct cw_LogWriter {
|
|
|
|
const char * name;
|
|
|
|
int colored;
|
|
|
|
void (*open) ();
|
|
|
|
void (*write) (int prio, const char *format, va_list args, struct cw_LogWriter *w);
|
|
|
|
void (*close) ();
|
|
|
|
void * priv;
|
|
|
|
};
|
2015-04-10 19:51:56 +02:00
|
|
|
|
2018-03-05 07:18:02 +01:00
|
|
|
extern struct cw_LogWriter cw_log_syslog_writer;
|
|
|
|
extern struct cw_LogWriter cw_log_console_writer;
|
2015-04-10 19:51:56 +02:00
|
|
|
|
2018-03-05 07:18:02 +01:00
|
|
|
void cw_log_init();
|
|
|
|
void cw_log(int level, const char *format, ...);
|
2018-03-30 19:45:27 +02:00
|
|
|
void cw_log_errno(char * format, ...);
|
2014-08-14 10:04:44 +02:00
|
|
|
|
2015-04-10 17:52:01 +02:00
|
|
|
extern const char *cw_log_name;
|
2018-03-18 21:48:34 +01:00
|
|
|
extern struct cw_LogWriter * cw_log_writers[];
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2015-02-08 13:29:56 +01:00
|
|
|
|
2018-03-25 11:14:37 +02:00
|
|
|
/**
|
|
|
|
* @} LOGDBG
|
|
|
|
*/
|
|
|
|
|
2015-04-10 17:52:01 +02:00
|
|
|
#endif
|