Logger.h 930 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * 2D Game Engine
  3. * Logger.h:
  4. * Based on pikuma.com 2D game engine in C++ and Lua course
  5. * Copyright (c) 2021 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 11/02/2021.
  8. */
  9. #ifndef GAMEENGINE_LOGGER_H
  10. #define GAMEENGINE_LOGGER_H
  11. #include <vector>
  12. typedef enum LogType
  13. {
  14. LOG_LOG,
  15. LOG_ERROR,
  16. LOG_WARNING,
  17. LOG_INFO,
  18. LOG_CRITICAL,
  19. LOG_DEBUG,
  20. } LogType;
  21. typedef struct LogEntry
  22. {
  23. LogType type;
  24. time_t timestamp;
  25. char *message;
  26. } LogEntry;
  27. class Logger
  28. {
  29. public:
  30. /* C++ is stupid. */
  31. static std::vector<LogEntry> messages;
  32. static void Log(const char *message, ...);
  33. static void Error(const char *message, ...);
  34. static void Warning(const char *message, ...);
  35. static void Info(const char *message, ...);
  36. static void Critical(const char *message, ...);
  37. static void Debug(const char *message, ...);
  38. };
  39. #endif /* GAMEENGINE_LOGGER_H */