ILogger.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #pragma once
  5. #include "IReferenceCounted.h"
  6. namespace irr
  7. {
  8. //! Possible log levels.
  9. //! When used has filter ELL_DEBUG means => log everything and ELL_NONE means => log (nearly) nothing.
  10. //! When used to print logging information ELL_DEBUG will have lowest priority while ELL_NONE
  11. //! messages are never filtered and always printed.
  12. enum ELOG_LEVEL
  13. {
  14. //! Used for printing information helpful in debugging
  15. ELL_DEBUG,
  16. //! Useful information to print. For example hardware info or something started/stopped.
  17. ELL_INFORMATION,
  18. //! Warnings that something isn't as expected and can cause oddities
  19. ELL_WARNING,
  20. //! Something did go wrong.
  21. ELL_ERROR,
  22. //! Logs with ELL_NONE will never be filtered.
  23. //! And used as filter it will remove all logging except ELL_NONE messages.
  24. ELL_NONE
  25. };
  26. //! Interface for logging messages, warnings and errors
  27. class ILogger : public virtual IReferenceCounted
  28. {
  29. public:
  30. //! Destructor
  31. virtual ~ILogger() {}
  32. //! Returns the current set log level.
  33. virtual ELOG_LEVEL getLogLevel() const = 0;
  34. //! Sets a new log level.
  35. /** With this value, texts which are sent to the logger are filtered
  36. out. For example setting this value to ELL_WARNING, only warnings and
  37. errors are printed out. Setting it to ELL_INFORMATION, which is the
  38. default setting, warnings, errors and informational texts are printed
  39. out.
  40. \param ll: new log level filter value. */
  41. virtual void setLogLevel(ELOG_LEVEL ll) = 0;
  42. //! Prints out a text into the log
  43. /** \param text: Text to print out.
  44. \param ll: Log level of the text. If the text is an error, set
  45. it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
  46. is just an informational text, set it to ELL_INFORMATION. Texts are
  47. filtered with these levels. If you want to be a text displayed,
  48. independent on what level filter is set, use ELL_NONE. */
  49. virtual void log(const c8 *text, ELOG_LEVEL ll = ELL_INFORMATION) = 0;
  50. //! Prints out a text into the log
  51. /** \param text: Text to print out.
  52. \param hint: Additional info. This string is added after a " :" to the
  53. string.
  54. \param ll: Log level of the text. If the text is an error, set
  55. it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
  56. is just an informational text, set it to ELL_INFORMATION. Texts are
  57. filtered with these levels. If you want to be a text displayed,
  58. independent on what level filter is set, use ELL_NONE. */
  59. virtual void log(const c8 *text, const c8 *hint, ELOG_LEVEL ll = ELL_INFORMATION) = 0;
  60. };
  61. } // end namespace