logging-guidelines.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. Some unresolved questions:
  2. - what context information should be present in each log line? how do we support
  3. easy and efficient searching and filtering of log output? how do we support
  4. easy use of grep and similar tools?
  5. - do we suggest that context information that doesn't change during an event
  6. should be reported only once? should context information be repeated or not in
  7. subsequent lines?
  8. LOGGING GUIDELINES
  9. ==================
  10. This document describes how to write and organize log statements in the INET
  11. framework. The target audience of this document includes maintainers, developers
  12. and contributors.
  13. General Logging Guidelines
  14. --------------------------
  15. Log output should be valid English sentences starting with an uppercase letter
  16. and ending with correct punctuation. Log output that spans multiple lines
  17. should use indentation where it isn't immediately obvious that the lines
  18. are related to each other. Dynamic content should be marked with single quotes.
  19. Key value pairs should be labeled and separated by '='. Enumerated values should
  20. be properly separated with spaces.
  21. Target Audience of Logging
  22. --------------------------
  23. The people who read the log output can be divided based on the knowledge they
  24. have regarding the protocol specification. They may know
  25. - the public interface of the protocol
  26. - the internals of the protocol
  27. - the actual implementation of the protocol
  28. Log Levels
  29. ----------
  30. This chapter describes when to use the various log levels provided by OMNeT++
  31. The rules presented here extend the rules provided in the OMNeT++ documentation.
  32. fatal
  33. - target for people (not necessarily programmers) who know the public interface
  34. - don't report programming errors, use C++ exceptions for this purpose
  35. - report protocol specific unrecoverable fatal error situations
  36. - use rarely if at all
  37. error
  38. - target for people (not necessarily programmers) who know the public interface
  39. - don't report programming errors, use C++ exceptions for this purpose
  40. - report protocol specific recoverable error situations
  41. warn
  42. - target for people (not necessarily programmers) who know the public interface
  43. - report protocol specific exceptional situations
  44. - don't report things that occur too often such as collisions on a radio channel
  45. info
  46. - target for people (not necessarily programmers) who know the public interface
  47. - think about the module as a closed (black) box
  48. - report protocol specific public input, output, state changes and decisions
  49. detail
  50. - target for users (not necessarily programmers) who know the internals
  51. - think about the module as an open (white) box
  52. - report protocol specific internal state changes and decisions
  53. - report scheduling and processing of protocol specific timers
  54. debug
  55. - target for developers/maintainers who know the actual implementation
  56. - report implementation specific state changes and decisions
  57. - report internal variable and data structure states and changes
  58. - report current states and transitions of state machines
  59. trace
  60. - target for developers/maintainers who know the actual implementation
  61. - report the execution of initialize stages, operation stages
  62. - report entering/leaving functions, loops, blocks, branches, recursions
  63. Log Categories
  64. --------------
  65. test
  66. - report output that is checked for in automated tests
  67. time
  68. - report performance related data that is measured in terms of wall clock time
  69. parameter
  70. - report the actual parameter values picked up during initialization
  71. default (empty)
  72. - report any other information using the default category