to_json.h 546 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // to_json.h
  3. // logger
  4. //
  5. // Created by Sam Jaffe on 4/4/19.
  6. //
  7. #pragma once
  8. #if defined(LOGGING_USE_JSON)
  9. #if defined(LOGGING_JSON_SJAFFE)
  10. #include "json/json.hpp"
  11. namespace logging {
  12. typedef json::value json;
  13. }
  14. #elif defined(LOGGING_JSON_VALUE)
  15. #include "json/json_fwd.h"
  16. namespace logging {
  17. typedef Json::Value json;
  18. }
  19. #endif
  20. namespace logging { namespace detail {
  21. template <typename T>
  22. json to_json(T const & obj);
  23. } }
  24. #else
  25. namespace logging { namespace detail {
  26. template <typename T> void to_json(T const &) {}
  27. } }
  28. #endif