log_dbglevels.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Copyright (C) 2011 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. #ifndef __LOG_DBGLVLS_H
  15. #define __LOG_DBGLVLS_H
  16. /// \file
  17. ///
  18. /// When a message is logged with DEBUG severity, the debug level associated
  19. /// with the message is also specified. This debug level is a number
  20. /// ranging from 0 to 99; the idea is that the higher the debug level, the
  21. /// more detailed the message.
  22. ///
  23. /// If debug messages are being logged, the logging system allows them to be
  24. /// filtered by debug level - only messages logged with a level equal to or
  25. /// less than the set debug level will be output. (For example, if the
  26. /// filter is set to 30, only debug messages logged with levels in the range
  27. /// 0 to 30 will be output; messages logged with levels 31 to 99 will be
  28. /// suppressed.)
  29. ///
  30. /// Levels of 30 or below are reserved for debug messages that are most
  31. /// likely to be useful for an administrator. Levels 31 to 99 are for use by
  32. /// someone familiar with the code. "Useful for an administrator" is,
  33. /// admittedly, a subjective term: it is loosely defined as messages helping
  34. /// someone diagnose a problem that they could solve without needing to dive
  35. /// into the code. So it covers things like start-up steps and configuration
  36. /// messages.
  37. ///
  38. /// In practice, this means that levels of 30 and below are most-likely to
  39. /// be used by the top-level programs, and 31 and above by the various
  40. /// libraries.
  41. ///
  42. /// This file defines a set of standard debug levels for use across all loggers.
  43. /// In this way users can have some expection of what will be output when
  44. /// enabling debugging. Symbols are prefixed DBGLVL so as not to clash with
  45. /// DBG_ symbols in the various modules.
  46. ///
  47. /// \note If the names of debug constants are changed, or if ones are added or
  48. /// removed, edit the file src/lib/python/isc/log/log.cc to update the log
  49. /// level definitions available to Python. The change does not need to be
  50. /// made if only the numeric values of constants are updated.
  51. namespace {
  52. /// Process startup/shutdown debug messages. Note that these are _debug_
  53. /// messages, as other messages related to startup and shutdown may be output
  54. /// with another severity. For example, when the authoritative server starts
  55. /// up, the "server started" message could be output at a severity of INFO.
  56. /// "Server starting" and messages indicating the stages in startup should be
  57. /// debug messages output at this severity.
  58. ///
  59. /// This is given a value of 0 as that is the level selected if debugging is
  60. /// enabled without giving a level.
  61. const int DBGLVL_START_SHUT = 0;
  62. /// This debug level is reserved for logging the exchange of messages/commands
  63. /// between processes, including configuration messages.
  64. const int DBGLVL_COMMAND = 10;
  65. /// If the commands have associated data, this level is when they are printed.
  66. /// This includes configuration messages.
  67. const int DBGLVL_COMMAND_DATA = 20;
  68. // The following constants are suggested values for common operations.
  69. // Depending on the exact nature of the code, modules may or may not use these
  70. // levels.
  71. /// Trace basic operations.
  72. const int DBGLVL_TRACE_BASIC = 40;
  73. /// Trace data associated with the basic operations.
  74. const int DBGLVL_TRACE_BASIC_DATA = 45;
  75. /// Trace detailed operations.
  76. const int DBGLVL_TRACE_DETAIL = 50;
  77. /// Trace data associated with detailed operations.
  78. const int DBGLVL_TRACE_DETAIL_DATA = 55;
  79. } // Anonymous namespace
  80. #endif // __LOG_DBGLVLS_H