Priority.hh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Priority.hh
  3. *
  4. * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
  5. * Copyright 2000, Bastiaan Bakker. All rights reserved.
  6. *
  7. * See the COPYING file for the terms of usage and distribution.
  8. */
  9. #ifndef _LOG4CPP_PRIORITY_HH
  10. #define _LOG4CPP_PRIORITY_HH
  11. #include "Base/GCException.h"
  12. #include <log4cpp/Portability.hh>
  13. #include <string>
  14. #include <stdexcept>
  15. /*
  16. * Optionally work around rudeness in windows.h on Win32.
  17. */
  18. #ifdef ERROR
  19. #ifdef LOG4CPP_FIX_ERROR_COLLISION
  20. LOG4CPP_NS_BEGIN
  21. static const int _tmpERRORValue = ERROR;
  22. LOG4CPP_NS_END
  23. #undef ERROR
  24. static const int ERROR = LOG4CPP_NS::_tmpERRORValue;
  25. #define ERROR ERROR
  26. #else // LOG4CPP_FIX_ERROR_COLLISION
  27. #error Naming collision for 'ERROR' detected. Please read the FAQ for a \
  28. workaround.
  29. #endif // LOG4CPP_FIX_ERROR_COLLISION
  30. #endif // ERROR
  31. /*
  32. * Other Win32 rudeness in EDK.h
  33. */
  34. #ifdef DEBUG
  35. #ifdef LOG4CPP_FIX_ERROR_COLLISION
  36. #undef DEBUG
  37. #define DEBUG DEBUG
  38. #else // LOG4CPP_FIX_ERROR_COLLISION
  39. #error Naming collision for 'DEBUG' detected. Please read the FAQ for a \
  40. workaround.
  41. #endif // LOG4CPP_FIX_ERROR_COLLISION
  42. #endif // DEBUG
  43. LOG4CPP_NS_BEGIN
  44. /**
  45. * The Priority class provides importance levels with which one
  46. * can categorize log messages.
  47. **/
  48. class LOG4CPP_EXPORT Priority {
  49. public:
  50. static const int MESSAGE_SIZE; // = 8;
  51. /**
  52. * Predefined Levels of Priorities. These correspond to the
  53. * priority levels used by syslog(3).
  54. **/
  55. typedef enum {
  56. EMERG = 0,
  57. FATAL = 0,
  58. ALERT = 100,
  59. CRIT = 200,
  60. ERROR = 300,
  61. WARN = 400,
  62. NOTICE = 500,
  63. INFO = 600,
  64. DEBUG = 700,
  65. NOTSET = 800
  66. } PriorityLevel;
  67. /**
  68. * The type of Priority Values
  69. **/
  70. typedef int Value;
  71. /**
  72. * Returns the name of the given priority value.
  73. * Currently, if the value is not one of the PriorityLevel values,
  74. * the method returns the name of the largest priority smaller
  75. * the given value.
  76. * @param priority the numeric value of the priority.
  77. * @returns a string representing the name of the priority.
  78. **/
  79. static const std::string& getPriorityName(int priority) throw();
  80. /**
  81. * Returns the value of the given priority name.
  82. * This can be either one of EMERG ... NOTSET or a
  83. * decimal string representation of the value, e.g. '700' for DEBUG.
  84. * @param priorityName the string containing the name of the priority
  85. * @return the value corresponding with the priority name
  86. * @throw GenICam::InvalidArgumentException if the priorityName does not
  87. * correspond with a known Priority name or a number
  88. **/
  89. static Value getPriorityValue(const std::string& priorityName);
  90. // throw(GenICam::InvalidArgumentException);
  91. };
  92. LOG4CPP_NS_END
  93. #endif // _LOG4CPP_PRIORITY_HH