log_dbglevels.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. namespace {
  47. /// Process startup/shutdown debug messages. Note that these are _debug_
  48. /// messages, as other messages related to startup and shutdown may be output
  49. /// with another severity. For example, when the authoritative server starts
  50. /// up, the "server started" message could be output at a severity of INFO.
  51. /// "Server starting" and messages indicating the stages in startup should be
  52. /// debug messages output at this severity.
  53. ///
  54. /// This is given a value of 0 as that is the level selected if debugging is
  55. /// enabled without giving a level.
  56. const int DBGLVL_START_SHUT = 0;
  57. /// This debug level is reserved for logging the exchange of messages/commands
  58. /// between processes, including configuration messages.
  59. const int DBGLVL_COMMAND = 10;
  60. /// If the commands have associated data, this level is when they are printed.
  61. /// This includes configuration messages.
  62. const int DBGLVL_COMMAND_DATA = 20;
  63. // The following constants are suggested values for common operations.
  64. // Depending on the exact nature of the code, modules may or may not used these
  65. // levels.
  66. /// Trace basic operations.
  67. const int DBGLVL_TRACE_BASIC = 40;
  68. /// Trace data associated with the basic operations.
  69. const int DBGLVL_TRACE_BASIC_DATA = 45;
  70. /// Trace detailed operations.
  71. const int DBGLVL_TRACE_DETAIL = 50;
  72. /// Trace data associated with detailed operations.
  73. const int DBGLVL_TRACE_DETAIL_DATA = 55;
  74. } // Anonymous namespace
  75. #endif // __LOG_DBGLVLS_H