Browse Source

[trac4090] Setup logger for eval

Shawn Routhier 9 years ago
parent
commit
a32f2a2aaa
4 changed files with 23 additions and 5 deletions
  1. 10 0
      doc/guide/logging.xml
  2. 9 2
      src/lib/eval/Makefile.am
  3. 2 0
      src/lib/eval/tests/Makefile.am
  4. 2 3
      src/lib/eval/token.cc

+ 10 - 0
doc/guide/logging.xml

@@ -220,6 +220,11 @@
             logger for the libdhcpsrv library.</simpara>
             logger for the libdhcpsrv library.</simpara>
           </listitem>
           </listitem>
           <listitem>
           <listitem>
+            <simpara><command>kea-dhcp4.eval</command> - this logger is used
+            to log messages relating to the evaluation code, primarily used
+            by the client classification routines.</simpara>
+          </listitem>
+          <listitem>
             <simpara><command>kea-dhcp4.hooks</command> - this logger is used
             <simpara><command>kea-dhcp4.hooks</command> - this logger is used
             to log messages related to management of hooks libraries, e.g.
             to log messages related to management of hooks libraries, e.g.
             registration and deregistration of the libraries, and to the
             registration and deregistration of the libraries, and to the
@@ -303,6 +308,11 @@
             logger for the libdhcpsrv library.</simpara>
             logger for the libdhcpsrv library.</simpara>
           </listitem>
           </listitem>
           <listitem>
           <listitem>
+            <simpara><command>kea-dhcp6.eval</command> - this logger is used
+            to log messages relating to the evaluation code, primarily used
+            by the client classification routines.</simpara>
+          </listitem>
+          <listitem>
             <simpara><command>kea-dhcp6.hooks</command> - this logger is used
             <simpara><command>kea-dhcp6.hooks</command> - this logger is used
             to log messages related to management of hooks libraries, e.g.
             to log messages related to management of hooks libraries, e.g.
             registration and deregistration of the libraries, and to the
             registration and deregistration of the libraries, and to the

+ 9 - 2
src/lib/eval/Makefile.am

@@ -12,14 +12,20 @@ AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
 
 
 lib_LTLIBRARIES = libkea-eval.la
 lib_LTLIBRARIES = libkea-eval.la
 libkea_eval_la_SOURCES  =
 libkea_eval_la_SOURCES  =
+libkea_eval_la_SOURCES += eval_log.cc eval_log.h
 libkea_eval_la_SOURCES += token.cc token.h
 libkea_eval_la_SOURCES += token.cc token.h
 
 
+nodist_libkea_eval_la_SOURCES = eval_messages.h eval_messages.cc
+
 libkea_eval_la_CXXFLAGS = $(AM_CXXFLAGS)
 libkea_eval_la_CXXFLAGS = $(AM_CXXFLAGS)
 libkea_eval_la_CPPFLAGS = $(AM_CPPFLAGS)
 libkea_eval_la_CPPFLAGS = $(AM_CPPFLAGS)
 libkea_eval_la_LIBADD   = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 libkea_eval_la_LIBADD   = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 libkea_eval_la_LIBADD  += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 libkea_eval_la_LIBADD  += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
+libkea_eval_la_LIBADD  += $(top_builddir)/src/lib/log/libkea-log.la
+libkea_eval_la_LIBADD  += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
+
 libkea_eval_la_LDFLAGS  = -no-undefined -version-info 3:0:0
 libkea_eval_la_LDFLAGS  = -no-undefined -version-info 3:0:0
-libkea_eval_la_LDFLAGS += $(LOG4CPLUS_LIBS) $(CRYPTO_LDFLAGS)
+libkea_eval_la_LDFLAGS += $(CRYPTO_LDFLAGS)
 
 
 EXTRA_DIST  = eval.dox
 EXTRA_DIST  = eval.dox
 EXTRA_DIST += eval_messages.mes
 EXTRA_DIST += eval_messages.mes
@@ -29,6 +35,7 @@ eval_messages.h eval_messages.cc: s-messages
 
 
 s-messages: eval_messages.mes
 s-messages: eval_messages.mes
 	$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/eval/eval_messages.mes
 	$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/eval/eval_messages.mes
+	touch $@
 
 
 # Tell Automake that the eval_messages.{cc,h} source files are created in the
 # Tell Automake that the eval_messages.{cc,h} source files are created in the
 # build process, so it must create these before doing anything else. Although
 # build process, so it must create these before doing anything else. Although
@@ -39,4 +46,4 @@ s-messages: eval_messages.mes
 # first.
 # first.
 BUILT_SOURCES = eval_messages.h eval_messages.cc
 BUILT_SOURCES = eval_messages.h eval_messages.cc
 
 
-CLEANFILES = eval_messages.h eval_messages.cc
+CLEANFILES = eval_messages.h eval_messages.cc s-messages

+ 2 - 0
src/lib/eval/tests/Makefile.am

@@ -2,6 +2,8 @@ SUBDIRS = .
 
 
 AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
 AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CPPFLAGS += -DLOGGING_SPEC_FILE=\"$(abs_top_srcdir)/src/lib/dhcpsrv/logging.spec\"
+
 AM_CXXFLAGS = $(KEA_CXXFLAGS)
 AM_CXXFLAGS = $(KEA_CXXFLAGS)
 
 
 # Some versions of GCC warn about some versions of Boost regarding
 # Some versions of GCC warn about some versions of Boost regarding

+ 2 - 3
src/lib/eval/token.cc

@@ -13,6 +13,7 @@
 // PERFORMANCE OF THIS SOFTWARE.
 // PERFORMANCE OF THIS SOFTWARE.
 
 
 #include <eval/token.h>
 #include <eval/token.h>
+#include <eval/eval_log.h>
 #include <boost/lexical_cast.hpp>
 #include <boost/lexical_cast.hpp>
 #include <string>
 #include <string>
 
 
@@ -90,13 +91,11 @@ TokenSubstring::evaluate(const Pkt& /*pkt*/, ValueStack& values) {
             length = boost::lexical_cast<int>(len_str);
             length = boost::lexical_cast<int>(len_str);
         }
         }
     } catch (const boost::bad_lexical_cast&) {
     } catch (const boost::bad_lexical_cast&) {
-#if 0
-        // Logging not yet built
         LOG_DEBUG(eval_logger, EVAL_DBG_TRACE,
         LOG_DEBUG(eval_logger, EVAL_DBG_TRACE,
                   EVAL_SUBSTRING_BAD_PARAM_CONVERSION)
                   EVAL_SUBSTRING_BAD_PARAM_CONVERSION)
             .arg(start_str)
             .arg(start_str)
             .arg(len_str);
             .arg(len_str);
-#endif
+
         values.push("");
         values.push("");
         return;
         return;
     }
     }