Parcourir la source

[3807] Added new loggers for DHCPv6 server.

Marcin Siodelski il y a 10 ans
Parent
commit
e283b1fb21
2 fichiers modifiés avec 83 ajouts et 13 suppressions
  1. 17 3
      src/bin/dhcp6/dhcp6_log.cc
  2. 66 10
      src/bin/dhcp6/dhcp6_log.h

+ 17 - 3
src/bin/dhcp6/dhcp6_log.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -12,14 +12,28 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-/// Defines the logger used by the top-level component of kea-dhcp6.
+/// @file dhcp6_log.cc
+/// Contains the loggers used by the DHCPv6 server component.
 
 #include <dhcp6/dhcp6_log.h>
 
 namespace isc {
 namespace dhcp {
 
-isc::log::Logger dhcp6_logger("dhcp6");
+const char* DHCP6_ROOT_LOGGER_NAME = "kea-dhcp6";
+const char* DHCP6_APP_LOGGER_NAME = "dhcp6";
+const char* DHCP6_BAD_PACKET_LOGGER_NAME = "bad-packets";
+const char* DHCP6_PACKET_LOGGER_NAME = "packets";
+const char* DHCP6_OPTIONS_LOGGER_NAME = "options";
+const char* DHCP6_DDNS_LOGGER_NAME = "ddns";
+const char* DHCP6_LEASE_LOGGER_NAME = "leases";
+
+isc::log::Logger dhcp6_logger(DHCP6_APP_LOGGER_NAME);
+isc::log::Logger bad_packet_logger(DHCP6_BAD_PACKET_LOGGER_NAME);
+isc::log::Logger packet_logger(DHCP6_PACKET_LOGGER_NAME);
+isc::log::Logger options_logger(DHCP6_OPTIONS_LOGGER_NAME);
+isc::log::Logger ddns_logger(DHCP6_DDNS_LOGGER_NAME);
+isc::log::Logger lease_logger(DHCP6_LEASE_LOGGER_NAME);
 
 } // namespace dhcp
 } // namespace isc

+ 66 - 10
src/bin/dhcp6/dhcp6_log.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -22,11 +22,8 @@
 namespace isc {
 namespace dhcp {
 
-/// \brief DHCP6 Logging
-///
-/// Defines the levels used to output debug messages in the non-library part of
-/// the kea-dhcp6 program.  Higher numbers equate to more verbose (and detailed)
-/// output.
+/// @name Constants defining debug levels for logging in DHCPv6 server.
+//@{
 
 // Debug levels used to log information during startup and shutdown.
 const int DBG_DHCP6_START = DBGLVL_START_SHUT;
@@ -50,12 +47,71 @@ const int DBG_DHCP6_DETAIL = DBGLVL_TRACE_DETAIL;
 // This level is used to log the contents of packets received and sent.
 const int DBG_DHCP6_DETAIL_DATA = DBGLVL_TRACE_DETAIL_DATA;
 
-/// Define the logger for the "dhcp6" module part of kea-dhcp6.  We could define
-/// a logger in each file, but we would want to define a common name to avoid
-/// spelling mistakes, so it is just one small step from there to define a
-/// module-common logger.
+//@}
+
+/// @name Constants holding names of loggers for the DHCPv6 server.
+//@{
+
+/// @brief Defines the name of the root level (default) logger.
+extern const char* DHCP6_ROOT_LOGGER_NAME;
+
+/// @brief Name of the base logger for DHCPv6 server.
+extern const char* DHCP6_APP_LOGGER_NAME;
+
+/// @brief Name of the logger for rejected packets.
+extern const char* DHCP6_BAD_PACKET_LOGGER_NAME;
+
+/// @brief Name of the logger for processed packets.
+extern const char* DHCP6_PACKET_LOGGER_NAME;
+
+/// @brief Name of the logger for options parser.
+extern const char* DHCP6_OPTIONS_LOGGER_NAME;
+
+/// @brief Name of the logger for hostname or FQDN processing.
+extern const char* DHCP6_DDNS_LOGGER_NAME;
+
+/// @brief Name of the logger for lease allocation logic.
+extern const char* DHCP6_LEASE_LOGGER_NAME;
+
+//@}
+
+/// @name Loggers used by the DHCPv6 server
+//@{
+
+/// @brief Base logger for DHCPv6 server.
 extern isc::log::Logger dhcp6_logger;
 
+/// @brief Logger for rejected packets.
+///
+/// Here "bad packets" are packets that are either dropped (i.e malformed,
+/// unsupported types) or packets that are rejected for logical reasons.
+extern isc::log::Logger bad_packet_logger;
+
+/// @brief Logger for processed packets.
+///
+/// This logger is used to issue log messages related to the reception and
+/// sending DHCP packets.
+extern isc::log::Logger packet_logger;
+
+/// @brief Logger for options parser.
+///
+/// This logger is used to issue log messages related to processing of the
+/// DHCP options 
+extern isc::log::Logger options_logger;
+
+/// @brief Logger for Hostname or FQDN processing.
+///
+/// This logger is used to issue log messages related to processing the
+/// hostnames, FQDNs and sending name change requests to D2.
+extern isc::log::Logger ddns_logger;
+
+/// @brief Logger for lease allocation logic.
+///
+/// This logger is used to issue log messages related to lease allocation.
+extern isc::log::Logger lease_logger;
+
+//@}
+
 } // namespace dhcp6
 } // namespace isc