ILogger.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_I_LOGGER_H_INCLUDED
  5. #define IRR_I_LOGGER_H_INCLUDED
  6. #include "IReferenceCounted.h"
  7. namespace irr
  8. {
  9. //! Possible log levels.
  10. //! When used has filter ELL_DEBUG means => log everything and ELL_NONE means => log (nearly) nothing.
  11. //! When used to print logging information ELL_DEBUG will have lowest priority while ELL_NONE
  12. //! messages are never filtered and always printed.
  13. enum ELOG_LEVEL
  14. {
  15. //! Used for printing information helpful in debugging
  16. ELL_DEBUG,
  17. //! Useful information to print. For example hardware info or something started/stopped.
  18. ELL_INFORMATION,
  19. //! Warnings that something isn't as expected and can cause oddities
  20. ELL_WARNING,
  21. //! Something did go wrong.
  22. ELL_ERROR,
  23. //! Logs with ELL_NONE will never be filtered.
  24. //! And used as filter it will remove all logging except ELL_NONE messages.
  25. ELL_NONE
  26. };
  27. //! Interface for logging messages, warnings and errors
  28. class ILogger : public virtual IReferenceCounted
  29. {
  30. public:
  31. //! Destructor
  32. virtual ~ILogger() {}
  33. //! Returns the current set log level.
  34. virtual ELOG_LEVEL getLogLevel() const = 0;
  35. //! Sets a new log level.
  36. /** With this value, texts which are sent to the logger are filtered
  37. out. For example setting this value to ELL_WARNING, only warnings and
  38. errors are printed out. Setting it to ELL_INFORMATION, which is the
  39. default setting, warnings, errors and informational texts are printed
  40. out.
  41. \param ll: new log level filter value. */
  42. virtual void setLogLevel(ELOG_LEVEL ll) = 0;
  43. //! Prints out a text into the log
  44. /** \param text: Text to print out.
  45. \param ll: Log level of the text. If the text is an error, set
  46. it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
  47. is just an informational text, set it to ELL_INFORMATION. Texts are
  48. filtered with these levels. If you want to be a text displayed,
  49. independent on what level filter is set, use ELL_NONE. */
  50. virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
  51. //! Prints out a text into the log
  52. /** \param text: Text to print out.
  53. \param hint: Additional info. This string is added after a " :" to the
  54. string.
  55. \param ll: Log level of the text. If the text is an error, set
  56. it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
  57. is just an informational text, set it to ELL_INFORMATION. Texts are
  58. filtered with these levels. If you want to be a text displayed,
  59. independent on what level filter is set, use ELL_NONE. */
  60. virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
  61. virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
  62. //! Prints out a text into the log
  63. /** \param text: Text to print out.
  64. \param hint: Additional info. This string is added after a " :" to the
  65. string.
  66. \param ll: Log level of the text. If the text is an error, set
  67. it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
  68. is just an informational text, set it to ELL_INFORMATION. Texts are
  69. filtered with these levels. If you want to be a text displayed,
  70. independent on what level filter is set, use ELL_NONE. */
  71. virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
  72. //! Prints out a text into the log
  73. /** \param text: Text to print out.
  74. \param ll: Log level of the text. If the text is an error, set
  75. it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
  76. is just an informational text, set it to ELL_INFORMATION. Texts are
  77. filtered with these levels. If you want to be a text displayed,
  78. independent on what level filter is set, use ELL_NONE. */
  79. virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
  80. };
  81. } // end namespace
  82. #endif