dhcp4_log.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // Copyright (C) 2012, 2014-2015 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. /// @file dhcp4_log.h
  15. /// Contains declarations for loggers used by the DHCPv4 server component.
  16. #ifndef DHCP4_LOG_H
  17. #define DHCP4_LOG_H
  18. #include <log/logger_support.h>
  19. #include <log/macros.h>
  20. #include <dhcp4/dhcp4_messages.h>
  21. namespace isc {
  22. namespace dhcp {
  23. /// @name Constants defining debug levels for logging in DHCPv4 server.
  24. //@{
  25. /// @brief Debug level used to log information during server startup.
  26. const int DBG_DHCP4_START = DBGLVL_START_SHUT;
  27. /// @brief Debug level used to log information during server shutdown.
  28. const int DBG_DHCP4_SHUT = DBGLVL_START_SHUT;
  29. /// @brief Debug level used to log receiving commands.
  30. const int DBG_DHCP4_COMMAND = DBGLVL_COMMAND;
  31. /// @brief Debug level used to trace basic operations within the code.
  32. const int DBG_DHCP4_BASIC = DBGLVL_TRACE_BASIC;
  33. /// @brief Debug level used to trace hook related operations
  34. const int DBG_DHCP4_HOOKS = DBGLVL_TRACE_BASIC;
  35. /// @brief Debug level used to log the traces with some basic data.
  36. ///
  37. /// The basic data includes summary information, e.g. summary of the
  38. /// information returned by a particular function. It may also include
  39. /// more detailed information in cases when it is warranted and the
  40. /// extraction of the data doesn't impact the server's performance
  41. /// significantly.
  42. const int DBG_DHCP4_BASIC_DATA = DBGLVL_TRACE_BASIC_DATA;
  43. /// @brief Debug level used to trace detailed errors.
  44. ///
  45. /// Trace detailed operations, including errors raised when processing invalid
  46. /// packets. (These are not logged at severities of WARN or higher for fear
  47. /// that a set of deliberately invalid packets set to the server could overwhelm
  48. /// the logging.)
  49. const int DBG_DHCP4_DETAIL = DBGLVL_TRACE_DETAIL;
  50. /// @brief This level is used to log the contents of packets received and sent.
  51. const int DBG_DHCP4_DETAIL_DATA = DBGLVL_TRACE_DETAIL_DATA;
  52. //@}
  53. /// @name Constants holding names of loggers for the DHCPv4 server.
  54. //@{
  55. /// @brief Defines the name of the root level (default) logger.
  56. extern const char* DHCP4_ROOT_LOGGER_NAME;
  57. /// @brief Name of the base logger for DHCPv4 server.
  58. extern const char* DHCP4_APP_LOGGER_NAME;
  59. /// @brief Name of the logger for rejected packets.
  60. extern const char* DHCP4_BAD_PACKET_LOGGER_NAME;
  61. /// @brief Name of the logger for processed packets.
  62. extern const char* DHCP4_PACKET_LOGGER_NAME;
  63. /// @brief Name of the logger for options parser.
  64. extern const char* DHCP4_OPTIONS_LOGGER_NAME;
  65. /// @brief Name of the logger for hostname or FQDN processing.
  66. extern const char* DHCP4_DDNS_LOGGER_NAME;
  67. /// @brief Name of the logger for lease allocation logic.
  68. extern const char* DHCP4_LEASE_LOGGER_NAME;
  69. //@}
  70. /// @name Loggers used by the DHCPv4 server
  71. //@{
  72. /// @brief Base logger for DHCPv4 server.
  73. extern isc::log::Logger dhcp4_logger;
  74. /// @brief Logger for rejected packets.
  75. ///
  76. /// Here "bad packets" are packets that are either dropped (i.e malformed,
  77. /// unsupported types) or packets that are rejected and NAKed for logical
  78. /// reasons.
  79. extern isc::log::Logger bad_packet4_logger;
  80. /// @brief Logger for processed packets.
  81. ///
  82. /// This logger is used to issue log messages related to the reception and
  83. /// sending DHCP packets.
  84. extern isc::log::Logger packet4_logger;
  85. /// @brief Logger for options parser.
  86. ///
  87. /// This logger is used to issue log messages related to processing of the
  88. /// DHCP options
  89. extern isc::log::Logger options4_logger;
  90. /// @brief Logger for Hostname or FQDN processing.
  91. ///
  92. /// This logger is used to issue log messages related to processing the
  93. /// hostnames, FQDNs and sending name change requests to D2.
  94. extern isc::log::Logger ddns4_logger;
  95. /// @brief Logger for lease allocation logic.
  96. ///
  97. /// This logger is used to issue log messages related to lease allocation.
  98. extern isc::log::Logger lease4_logger;
  99. //@}
  100. } // namespace dhcp4
  101. } // namespace isc
  102. #endif // DHCP4_LOG_H