log.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <string>
  3. #include <deque>
  4. #include <sstream>
  5. #include <pushNotification/pushNotification.h>
  6. namespace pika
  7. {
  8. struct LogManager
  9. {
  10. static constexpr const char *DefaultLogFile = PIKA_RESOURCES_PATH "logs.txt";
  11. //a null name will just log to a internal structure
  12. void init(std::string name);
  13. //this will be dependent on the configuration of the project.
  14. void log(const char *l, int type = pika::logNormal);
  15. std::string name = "";
  16. bool firstLog = 0;
  17. static constexpr int maxInternalLogCount = 200;
  18. std::deque<std::string> internalLogs; //used to print the logs in a internal console
  19. pika::PushNotificationManager *pushNotificationManager = 0;
  20. private:
  21. //used only interally.
  22. void logToFile(const char *l, int type = pika::logNormal);
  23. void logInternally(const char *l, int type = pika::logNormal);
  24. void logToPushNotification(const char *l, int type = pika::logNormal);
  25. };
  26. void logToFile(const char *fileName, const char *l, int type = pika::logNormal);
  27. }