diff options
Diffstat (limited to 'util/trace_logging/scoped_trace_operations.h')
-rw-r--r-- | util/trace_logging/scoped_trace_operations.h | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/util/trace_logging/scoped_trace_operations.h b/util/trace_logging/scoped_trace_operations.h index b01e3210..7b088f61 100644 --- a/util/trace_logging/scoped_trace_operations.h +++ b/util/trace_logging/scoped_trace_operations.h @@ -36,19 +36,17 @@ class ScopedTraceOperation { // Getters the current Trace Hierarchy. If the traces_ stack hasn't been // created yet, return as if the empty root node is there. - static platform::TraceId current_id() { - return traces_ == nullptr ? platform::kEmptyTraceId - : traces_->top()->trace_id_; + static TraceId current_id() { + return traces_ == nullptr ? kEmptyTraceId : traces_->top()->trace_id_; } - static platform::TraceId root_id() { - return traces_ == nullptr ? platform::kEmptyTraceId - : traces_->top()->root_id_; + static TraceId root_id() { + return traces_ == nullptr ? kEmptyTraceId : traces_->top()->root_id_; } - static platform::TraceIdHierarchy hierarchy() { + static TraceIdHierarchy hierarchy() { if (traces_ == nullptr) { - return platform::TraceIdHierarchy::Empty(); + return TraceIdHierarchy::Empty(); } return traces_->top()->to_hierarchy(); @@ -68,7 +66,7 @@ class ScopedTraceOperation { // the ternary operator in the macros simpler. static bool TraceAsyncEnd(const uint32_t line, const char* file, - platform::TraceId id, + TraceId id, Error::Code e); protected: @@ -79,18 +77,16 @@ class ScopedTraceOperation { virtual void SetTraceResult(Error::Code error) = 0; // Constructor to set all trace id information. - ScopedTraceOperation(platform::TraceId current_id = platform::kUnsetTraceId, - platform::TraceId parent_id = platform::kUnsetTraceId, - platform::TraceId root_id = platform::kUnsetTraceId); + ScopedTraceOperation(TraceId current_id = kUnsetTraceId, + TraceId parent_id = kUnsetTraceId, + TraceId root_id = kUnsetTraceId); // Current TraceId information. - platform::TraceId trace_id_; - platform::TraceId parent_id_; - platform::TraceId root_id_; + TraceId trace_id_; + TraceId parent_id_; + TraceId root_id_; - platform::TraceIdHierarchy to_hierarchy() { - return {trace_id_, parent_id_, root_id_}; - } + TraceIdHierarchy to_hierarchy() { return {trace_id_, parent_id_, root_id_}; } private: // NOTE: A std::vector is used for backing the stack because it provides the @@ -115,26 +111,26 @@ class ScopedTraceOperation { // The class which does actual trace logging. class TraceLoggerBase : public ScopedTraceOperation { public: - TraceLoggerBase(platform::TraceCategory::Value category, + TraceLoggerBase(TraceCategory::Value category, const char* name, const char* file, uint32_t line, - platform::TraceId current = platform::kUnsetTraceId, - platform::TraceId parent = platform::kUnsetTraceId, - platform::TraceId root = platform::kUnsetTraceId); + TraceId current = kUnsetTraceId, + TraceId parent = kUnsetTraceId, + TraceId root = kUnsetTraceId); - TraceLoggerBase(platform::TraceCategory::Value category, + TraceLoggerBase(TraceCategory::Value category, const char* name, const char* file, uint32_t line, - platform::TraceIdHierarchy ids); + TraceIdHierarchy ids); protected: // Set the result. void SetTraceResult(Error::Code error) override { result_ = error; } // Timestamp for when the object was created. - platform::Clock::time_point start_time_; + Clock::time_point start_time_; // Result of this operation. Error::Code result_; @@ -149,7 +145,7 @@ class TraceLoggerBase : public ScopedTraceOperation { uint32_t line_number_; // Category of this trace log. - platform::TraceCategory::Value category_; + TraceCategory::Value category_; private: OSP_DISALLOW_COPY_AND_ASSIGN(TraceLoggerBase); @@ -179,7 +175,7 @@ class AsynchronousTraceLogger : public TraceLoggerBase { // the current TraceId Hierarchy manually. class TraceIdSetter : public ScopedTraceOperation { public: - explicit TraceIdSetter(platform::TraceIdHierarchy ids) + explicit TraceIdSetter(TraceIdHierarchy ids) : ScopedTraceOperation(ids.current, ids.parent, ids.root) {} ~TraceIdSetter() final; |