aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/debug
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-11-14 16:25:25 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-11-14 16:29:35 -0800
commit90ffc3a6f74ee6f7db925a054b6f3973bd0d9fc5 (patch)
tree49f7b69358e4a95838e7e37e124db8f5e0a680fd /src/core/lib/debug
parent467e8369a896397d40abf7c3e9141c1e7440a2e4 (diff)
Add tracer peer to keep set_enabled private()
Diffstat (limited to 'src/core/lib/debug')
-rw-r--r--src/core/lib/debug/trace.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h
index cc9d9d2b2d..5e5143e502 100644
--- a/src/core/lib/debug/trace.h
+++ b/src/core/lib/debug/trace.h
@@ -45,6 +45,8 @@ void grpc_tracer_shutdown(void);
namespace grpc_core {
class TraceFlag {
+ friend class TraceFlagPeer;
+
public:
TraceFlag(bool default_enabled, const char* name);
~TraceFlag() {}
@@ -61,8 +63,9 @@ class TraceFlag {
#endif
}
- // Only to be used for testing purposes. Tracers should usually be set using
- // the static Set function
+ private:
+ static void LogAllTracers();
+
void set_enabled(bool enabled) {
#ifdef GRPC_THREADSAFE_TRACER
gpr_atm_no_barrier_store(&value_, enabled);
@@ -71,9 +74,6 @@ class TraceFlag {
#endif
}
- private:
- static void LogAllTracers();
-
static TraceFlag* root_tracer_;
TraceFlag* next_tracer_;
const char* const name_;
@@ -91,6 +91,9 @@ class DebugOnlyTraceFlag {
public:
DebugOnlyTraceFlag(bool default_enabled, const char* name) {}
bool enabled() { return false; }
+
+ private:
+ void set_enabled(bool enabled) {}
};
#endif