From 872ac0485ae3c7b74d6adb23e64677e835737f8e Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Mon, 31 Aug 2015 21:51:10 +0300 Subject: [PATCH] Added logger for rlm_stg. --- projects/rlm_stg/Makefile | 9 ++++++--- projects/rlm_stg/radlog.c | 23 +++++++++++++++++++++++ projects/rlm_stg/radlog.h | 14 ++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 projects/rlm_stg/radlog.c create mode 100644 projects/rlm_stg/radlog.h diff --git a/projects/rlm_stg/Makefile b/projects/rlm_stg/Makefile index 72788bcb..c17a740b 100644 --- a/projects/rlm_stg/Makefile +++ b/projects/rlm_stg/Makefile @@ -10,7 +10,8 @@ PROG = $(LIB_NAME).so SRCS = ./rlm_stg.c \ ./iface.cpp \ - ./stg_client.cpp + ./stg_client.cpp \ + ./radlog.c STGLIBS = crypto \ common \ @@ -22,10 +23,12 @@ STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS))) LIBS += $(addprefix -lstg,$(STGLIBS)) $(LIB_THREAD) $(LIBICONV) ifeq ($(OS),linux) -LIBS += -ldl +LIBS += -ldl \ + -lyajl else LIBS += -lintl \ - -lc + -lc \ + -lyajl endif SEARCH_DIRS = -I ../../include diff --git a/projects/rlm_stg/radlog.c b/projects/rlm_stg/radlog.c new file mode 100644 index 00000000..523dc1c4 --- /dev/null +++ b/projects/rlm_stg/radlog.c @@ -0,0 +1,23 @@ +#include "radlog.h" + +//#ifndef NDEBUG +//#define NDEBUG +#include +#include +#include +//#undef NDEBUG +//#endif + +#include + +void RadLog(const char* format, ...) +{ + char buf[1024]; + + va_list vl; + va_start(vl, format); + vsnprintf(buf, sizeof(buf), format, vl); + va_end(vl); + + DEBUG("[rlm_stg] *** %s", buf); +} diff --git a/projects/rlm_stg/radlog.h b/projects/rlm_stg/radlog.h new file mode 100644 index 00000000..00a5dcb5 --- /dev/null +++ b/projects/rlm_stg/radlog.h @@ -0,0 +1,14 @@ +#ifndef __STG_RADLOG_H__ +#define __STG_RADLOG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void RadLog(const char* format, ...); + +#ifdef __cplusplus +} +#endif + +#endif -- 2.44.2