diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-07-17 03:50:07 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-08-01 18:16:51 +0300 |
commit | 620e46c8b59b6269784ebba42b23f23897eeedb9 (patch) | |
tree | 6b396fdec4964d0305bbbb62195ebf56e636c78e /src/node_trace_events.cc | |
parent | 3ac94dc977b232a4502307733af2b3af60e7b102 (diff) |
src: refactor default trace writer out of agent
The agent code is supposed to manage multiple writers/clients.
Adding the default writer into the mix breaks that encapsulation.
Instead, manage default options through a separate "virtual"
default client handle, and keep the file writer management
all to the actual users.
PR-URL: https://github.com/nodejs/node/pull/21867
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'src/node_trace_events.cc')
-rw-r--r-- | src/node_trace_events.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 06063a449b9..d59b9255579 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -58,7 +58,7 @@ void NodeCategorySet::New(const FunctionCallbackInfo<Value>& args) { if (!*val) return; categories.emplace(*val); } - CHECK_NOT_NULL(env->tracing_agent()); + CHECK_NOT_NULL(env->tracing_agent_writer()); new NodeCategorySet(env, args.This(), std::move(categories)); } @@ -69,7 +69,7 @@ void NodeCategorySet::Enable(const FunctionCallbackInfo<Value>& args) { CHECK_NOT_NULL(category_set); const auto& categories = category_set->GetCategories(); if (!category_set->enabled_ && !categories.empty()) { - env->tracing_agent()->Enable(categories); + env->tracing_agent_writer()->Enable(categories); category_set->enabled_ = true; } } @@ -81,14 +81,15 @@ void NodeCategorySet::Disable(const FunctionCallbackInfo<Value>& args) { CHECK_NOT_NULL(category_set); const auto& categories = category_set->GetCategories(); if (category_set->enabled_ && !categories.empty()) { - env->tracing_agent()->Disable(categories); + env->tracing_agent_writer()->Disable(categories); category_set->enabled_ = false; } } void GetEnabledCategories(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); - std::string categories = env->tracing_agent()->GetEnabledCategories(); + std::string categories = + env->tracing_agent_writer()->agent()->GetEnabledCategories(); if (!categories.empty()) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), |