]> git.stg.codes - stg.git/commitdiff
Added logger for rlm_stg.
authorMaxim Mamontov <faust.madf@gmail.com>
Mon, 31 Aug 2015 18:51:10 +0000 (21:51 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Mon, 31 Aug 2015 18:51:10 +0000 (21:51 +0300)
projects/rlm_stg/Makefile
projects/rlm_stg/radlog.c [new file with mode: 0644]
projects/rlm_stg/radlog.h [new file with mode: 0644]

index 72788bcb7cd5825c9889be62ab288f9d29afb8cf..c17a740bf4725fa27441d6c893b4cbb65e18eb70 100644 (file)
@@ -10,7 +10,8 @@ PROG = $(LIB_NAME).so
 
 SRCS = ./rlm_stg.c \
        ./iface.cpp \
 
 SRCS = ./rlm_stg.c \
        ./iface.cpp \
-       ./stg_client.cpp
+       ./stg_client.cpp \
+       ./radlog.c
 
 STGLIBS = crypto \
           common \
 
 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 += $(addprefix -lstg,$(STGLIBS)) $(LIB_THREAD) $(LIBICONV)
 
 ifeq ($(OS),linux)
-LIBS += -ldl
+LIBS += -ldl \
+       -lyajl
 else
 LIBS += -lintl \
 else
 LIBS += -lintl \
-        -lc
+        -lc \
+       -lyajl
 endif
 
 SEARCH_DIRS = -I ../../include
 endif
 
 SEARCH_DIRS = -I ../../include
diff --git a/projects/rlm_stg/radlog.c b/projects/rlm_stg/radlog.c
new file mode 100644 (file)
index 0000000..523dc1c
--- /dev/null
@@ -0,0 +1,23 @@
+#include "radlog.h"
+
+//#ifndef NDEBUG
+//#define NDEBUG
+#include <freeradius/ident.h>
+#include <freeradius/radiusd.h>
+#include <freeradius/modules.h>
+//#undef NDEBUG
+//#endif
+
+#include <stdarg.h>
+
+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 (file)
index 0000000..00a5dcb
--- /dev/null
@@ -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