logpacket.h 845 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "level.h"
  3. #include "message.h"
  4. #if defined(_MSC_VER)
  5. #define log_here \
  6. { __FILE__, __LINE__, __FUNCTION__, __FUNCSIG__ }
  7. #else
  8. #define log_here \
  9. { __FILE__, __LINE__, __FUNCTION__, __PRETTY_FUNCTION__ }
  10. #endif
  11. namespace logging {
  12. struct location_info {
  13. char const * filename = "???";
  14. int line = 0;
  15. char const * function = "";
  16. char const * pretty_function = "";
  17. };
  18. struct logpacket {
  19. struct timeval time;
  20. // int thread_id;
  21. level level;
  22. location_info info;
  23. std::string logger;
  24. message message;
  25. };
  26. #if defined(_WIN32)
  27. constexpr char const * const NEWLINE_TOKEN{"\r\n"};
  28. #else
  29. constexpr char const * const NEWLINE_TOKEN{"\n"};
  30. #endif
  31. }