2020#include < string>
2121
2222#include " monotonic_clock.hpp"
23- #include " score /json/json_writer.h "
23+ #include < nlohmann /json.hpp >
2424
2525#define _TRACING (target, level, fields... ) \
2626 do { \
@@ -58,8 +58,7 @@ class Subscriber {
5858 template <typename ... T>
5959 void event (const std::optional<std::string>& target, const Level& level,
6060 std::pair<std::string, T>... fields) const {
61- using namespace score ::json;
62- Object fields_object{object_create (fields...)};
61+ nlohmann::json fields_object = object_create (fields...);
6362 handle_event (target, level, std::move (fields_object));
6463 }
6564
@@ -69,15 +68,15 @@ class Subscriber {
6968 MonotonicClock timer_;
7069
7170 void handle_event (const std::optional<std::string>& target, const Level& level,
72- score ::json::Object && fields) const ;
71+ nlohmann ::json&& fields) const ;
7372
74- score ::json::Object object_create () const { return score ::json::Object{} ; }
73+ nlohmann ::json object_create () const { return nlohmann ::json::object () ; }
7574
7675 template <typename HeadT, typename ... TailT>
77- score ::json::Object object_create (std::pair<std::string, HeadT> field,
78- std::pair<std::string, TailT>... fields) const {
79- auto object{ object_create (fields...)} ;
80- object. insert ( field) ;
76+ nlohmann ::json object_create (std::pair<std::string, HeadT> field,
77+ std::pair<std::string, TailT>... fields) const {
78+ auto object = object_create (fields...);
79+ object[field. first ] = field. second ;
8180 return object;
8281 }
8382};
0 commit comments