You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

56 lines
1.2 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. //
  11. // The Log interface
  12. // -----------------
  13. // The central logging system.
  14. //
  15. #if !defined __LOL_LOG_H__
  16. #define __LOL_LOG_H__
  17. #include <stdint.h>
  18. #include <cstdarg>
  19. namespace lol
  20. {
  21. class Log
  22. {
  23. public:
  24. #ifdef __GNUC__
  25. # define LOL_FMT_ATTR(n, p) __attribute__((format(printf, n, p)))
  26. #else
  27. # define LOL_FMT_ATTR(n, p)
  28. #endif
  29. static void Debug(char const *format, ...) LOL_FMT_ATTR(1, 2);
  30. static void Info(char const *format, ...) LOL_FMT_ATTR(1, 2);
  31. static void Warn(char const *format, ...) LOL_FMT_ATTR(1, 2);
  32. static void Error(char const *format, ...) LOL_FMT_ATTR(1, 2);
  33. #undef LOL_FMT_ATTR
  34. private:
  35. enum MessageType
  36. {
  37. DebugMessage,
  38. InfoMessage,
  39. WarnMessage,
  40. ErrorMessage
  41. };
  42. static void Helper(MessageType type, char const *fmt, va_list ap);
  43. };
  44. } /* namespace lol */
  45. #endif // __LOL_LOG_H__