File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ void Trace::fillDefaultConfig(Json &cfg) const
39
39
{
40
40
"enable": false,
41
41
"max_size": 1024,
42
- "enable_sync ": false
42
+ "sync_enable ": false
43
43
}
44
44
)" _json;
45
45
}
@@ -52,24 +52,27 @@ bool Trace::initialize(Context &ctx, const Json &cfg)
52
52
auto &js_trace = cfg.at (" trace" );
53
53
54
54
bool is_enable = false ;
55
- bool is_enable_sync = false ;
55
+ bool is_sync_enable = false ;
56
56
std::string path_prefix;
57
57
int max_size = 0 ;
58
58
59
59
util::json::GetField (js_trace, " path_prefix" , path_prefix);
60
60
util::json::GetField (js_trace, " enable" , is_enable);
61
61
util::json::GetField (js_trace, " max_size" , max_size);
62
- util::json::GetField (js_trace, " enable_sync " , is_enable_sync );
62
+ util::json::GetField (js_trace, " sync_enable " , is_sync_enable );
63
63
64
64
auto &sink = trace::Sink::GetInstance ();
65
65
66
66
if (max_size > 0 )
67
67
sink.setRecordFileMaxSize (1024 * max_size);
68
68
69
- if (is_enable_sync )
69
+ if (is_sync_enable )
70
70
sink.setFileSyncEnable (true );
71
71
72
- if (sink.setPathPrefix (path_prefix) && is_enable)
72
+ if (!path_prefix.empty ())
73
+ sink.setPathPrefix (path_prefix);
74
+
75
+ if (is_enable)
73
76
sink.enable ();
74
77
}
75
78
return true ;
You can’t perform that action at this time.
0 commit comments