drop log4c support
This commit is contained in:
parent
b41edfb0b4
commit
48e92149e4
9 changed files with 2 additions and 133 deletions
|
|
@ -35,22 +35,11 @@ if LIBUSB_ENABLED
|
|||
libnfc_la_LIBADD += @libusb_LIBS@
|
||||
endif
|
||||
|
||||
if HAS_LOG4C
|
||||
libnfc_la_CFLAGS += @log4c_CFLAGS@
|
||||
libnfc_la_LIBADD += @log4c_LIBS@
|
||||
|
||||
libnfc_la_SOURCES += log-log4c.c
|
||||
else
|
||||
if WITH_DEBUG
|
||||
libnfc_la_CFLAGS += @log4c_CFLAGS@
|
||||
libnfc_la_LIBADD += @log4c_LIBS@
|
||||
|
||||
libnfc_la_SOURCES += log-printf.c
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
log-log4c.c \
|
||||
log-printf.c
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,3 @@ libnfcbuses_la_CFLAGS = -I$(top_srcdir)/libnfc
|
|||
|
||||
EXTRA_DIST = uart_posix.c uart_win32.c
|
||||
|
||||
if HAS_LOG4C
|
||||
libnfcbuses_la_CFLAGS += @log4c_CFLAGS@
|
||||
libnfcbuses_la_LIBADD = @log4c_LIBS@
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -7,9 +7,3 @@ noinst_LTLIBRARIES = libnfcchips.la
|
|||
libnfcchips_la_SOURCES = pn53x.c
|
||||
libnfcchips_la_CFLAGS = -I$(top_srcdir)/libnfc
|
||||
|
||||
|
||||
if HAS_LOG4C
|
||||
libnfcchips_la_CFLAGS += @log4c_CFLAGS@
|
||||
libnfcchips_la_LIBADD = @log4c_LIBS@
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,3 @@ if LIBUSB_ENABLED
|
|||
libnfcdrivers_la_LIBADD += @libusb_LIBS@
|
||||
endif
|
||||
|
||||
if HAS_LOG4C
|
||||
libnfcdrivers_la_CFLAGS += @log4c_CFLAGS@
|
||||
libnfcdrivers_la_LIBADD += @log4c_LIBS@
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
/*-
|
||||
* Copyright (C) 2011, Romain Tartière, Romuald Conty
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <log4c.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
static uint8_t __log_init_counter = 0;
|
||||
|
||||
int
|
||||
log_init (void)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if (__log_init_counter == 0) {
|
||||
res = log4c_init ();
|
||||
}
|
||||
if (!res) {
|
||||
__log_init_counter++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
log_fini (void)
|
||||
{
|
||||
int res = 0;
|
||||
if (__log_init_counter >= 1) {
|
||||
if (__log_init_counter == 1) {
|
||||
res = log4c_fini ();
|
||||
}
|
||||
__log_init_counter--;
|
||||
} else {
|
||||
res = -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
log_put (char *category, int priority, char *format, ...)
|
||||
{
|
||||
const log4c_category_t *cat = log4c_category_get (category);
|
||||
if (log4c_category_is_priority_enabled (cat, priority)) {
|
||||
va_list va;
|
||||
va_start (va, format);
|
||||
log4c_category_vlog (cat, priority, format, va);
|
||||
// va_end (va);
|
||||
}
|
||||
}
|
||||
22
libnfc/log.h
22
libnfc/log.h
|
|
@ -22,26 +22,8 @@
|
|||
# include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#if defined(HAS_LOG4C) && HAS_LOG4C
|
||||
// log4c have been detected so we use it..
|
||||
#include <log4c.h>
|
||||
#define LOGGING 1
|
||||
|
||||
int log_init (void);
|
||||
int log_fini (void);
|
||||
void log_put (char *category, int priority, char *format, ...);
|
||||
|
||||
#define NFC_PRIORITY_FATAL LOG4C_PRIORITY_FATAL
|
||||
#define NFC_PRIORITY_ALERT LOG4C_PRIORITY_ALERT
|
||||
#define NFC_PRIORITY_CRIT LOG4C_PRIORITY_CRIT
|
||||
#define NFC_PRIORITY_ERROR LOG4C_PRIORITY_ERROR
|
||||
#define NFC_PRIORITY_WARN LOG4C_PRIORITY_WARN
|
||||
#define NFC_PRIORITY_NOTICE LOG4C_PRIORITY_NOTICE
|
||||
#define NFC_PRIORITY_INFO LOG4C_PRIORITY_INFO
|
||||
#define NFC_PRIORITY_DEBUG LOG4C_PRIORITY_DEBUG
|
||||
#define NFC_PRIORITY_TRACE LOG4C_PRIORITY_TRACE
|
||||
#elif defined DEBUG
|
||||
// log4c is not detected but user want debug features
|
||||
#if defined DEBUG
|
||||
// User want debug features
|
||||
#define LOGGING 1
|
||||
int log_init (void);
|
||||
int log_fini (void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue