log_dbglevels.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. #ifndef LOG_DBGLVLS_H
  7. #define LOG_DBGLVLS_H
  8. /// \file
  9. ///
  10. /// When a message is logged with DEBUG severity, the debug level associated
  11. /// with the message is also specified. This debug level is a number
  12. /// ranging from 0 to 99; the idea is that the higher the debug level, the
  13. /// more detailed the message.
  14. ///
  15. /// If debug messages are being logged, the logging system allows them to be
  16. /// filtered by debug level - only messages logged with a level equal to or
  17. /// less than the set debug level will be output. (For example, if the
  18. /// filter is set to 30, only debug messages logged with levels in the range
  19. /// 0 to 30 will be output; messages logged with levels 31 to 99 will be
  20. /// suppressed.)
  21. ///
  22. /// Levels of 30 or below are reserved for debug messages that are most
  23. /// likely to be useful for an administrator. Levels 31 to 99 are for use by
  24. /// someone familiar with the code. "Useful for an administrator" is,
  25. /// admittedly, a subjective term: it is loosely defined as messages helping
  26. /// someone diagnose a problem that they could solve without needing to dive
  27. /// into the code. So it covers things like start-up steps and configuration
  28. /// messages.
  29. ///
  30. /// In practice, this means that levels of 30 and below are most-likely to
  31. /// be used by the top-level programs, and 31 and above by the various
  32. /// libraries.
  33. ///
  34. /// This file defines a set of standard debug levels for use across all loggers.
  35. /// In this way users can have some expectation of what will be output when
  36. /// enabling debugging. Symbols are prefixed DBGLVL so as not to clash with
  37. /// DBG_ symbols in the various modules.
  38. namespace {
  39. /// Process startup/shutdown debug messages. Note that these are _debug_
  40. /// messages, as other messages related to startup and shutdown may be output
  41. /// with another severity. For example, when the authoritative server starts
  42. /// up, the "server started" message could be output at a severity of INFO.
  43. /// "Server starting" and messages indicating the stages in startup should be
  44. /// debug messages output at this severity.
  45. ///
  46. /// This is given a value of 0 as that is the level selected if debugging is
  47. /// enabled without giving a level.
  48. const int DBGLVL_START_SHUT = 0;
  49. /// This debug level is reserved for logging the exchange of messages/commands
  50. /// between processes, including configuration messages.
  51. const int DBGLVL_COMMAND = 10;
  52. /// If the commands have associated data, this level is when they are printed.
  53. /// This includes configuration messages.
  54. const int DBGLVL_COMMAND_DATA = 20;
  55. // The following constants are suggested values for common operations.
  56. // Depending on the exact nature of the code, modules may or may not use these
  57. // levels.
  58. /// Trace basic operations.
  59. const int DBGLVL_TRACE_BASIC = 40;
  60. /// Trace data associated with the basic operations.
  61. const int DBGLVL_TRACE_BASIC_DATA = 45;
  62. /// Trace detailed operations.
  63. const int DBGLVL_TRACE_DETAIL = 50;
  64. /// Trace data associated with detailed operations.
  65. const int DBGLVL_TRACE_DETAIL_DATA = 55;
  66. } // Anonymous namespace
  67. #endif // LOG_DBGLVLS_H