File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed
Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -68,14 +68,13 @@ namespace MAT_NS_BEGIN {
6868 return result;
6969 }
7070
71- ILogConfiguration FromJSON ( const char * configuration)
71+ void MergeFromJSON (ILogConfiguration &config, const char * configuration)
7272 {
73- ILogConfiguration result;
7473#ifdef HAVE_MAT_JSONHPP
75- auto src = json::parse (configuration);
76- std::function<void (json &src , VariantMap &dst)> parse;
77- parse = [&parse](json &src , VariantMap &dst)->void {
78- for (json::iterator it = src .begin (); it != src .end (); ++it) {
74+ auto jsonRoot = json::parse (configuration);
75+ std::function<void (json &node , VariantMap &dst)> parse;
76+ parse = [&parse](json &node , VariantMap &dst)->void {
77+ for (json::iterator it = node .begin (); it != node .end (); ++it) {
7978 auto t = it.value ().type ();
8079 switch (t)
8180 {
@@ -119,11 +118,17 @@ namespace MAT_NS_BEGIN {
119118 }
120119 }
121120 };
122- parse (src , *result );
121+ parse (jsonRoot , *config );
123122#else
124123 (void )(configuration);
125124 assert (false /* json.hpp support is not enabled! */ );
126125#endif
126+ }
127+
128+ ILogConfiguration FromJSON (const char * configuration)
129+ {
130+ ILogConfiguration result;
131+ MergeFromJSON (result, configuration);
127132 return result;
128133 }
129134
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ namespace MAT_NS_BEGIN {
106106
107107 MATSDK_LIBABI ILogConfiguration FromJSON (const char * json);
108108
109+ MATSDK_LIBABI void MergeFromJSON (ILogConfiguration &config, const char * json);
110+
109111} MAT_NS_END
110112
111113#endif
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ +(nullable ILogger *)initializeLogManager:(nonnull NSString *)tenantToken withCo
135135 if (jsonData)
136136 {
137137 NSString *jsonString = [[NSString alloc ] initWithData: jsonData encoding: NSUTF8StringEncoding];
138- logManagerConfig = MAT::FromJSON ( [jsonString UTF8String ]);
138+ MAT::MergeFromJSON (logManagerConfig, [jsonString UTF8String ]);
139139 }
140140 else
141141 {
You can’t perform that action at this time.
0 commit comments