Skip to content

Commit

Permalink
Enable traces to use custom trace system instead of pigweed only (#17972
Browse files Browse the repository at this point in the history
)

* Enable traces to use custom trace system instead of pigweed only

* Restyled by clang-format

* Add MatterCustomTrace to wordlist

* change MATTER_CUSTOM_TRACE if define guard

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 18, 2024
1 parent 1805b98 commit 1155768
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ ManufacturingDate
masterkey
matterBuildSrcDir
matterc
MatterCustomTrace
matterd
MatterLock
matterSdkSourceBuild
Expand Down
4 changes: 4 additions & 0 deletions src/trace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Matter tracing provides a tool for applications to trace information about the
execution of the application. It depends on
[pw_trace module](https://pigweed.dev/pw_trace/).

Application can override trace events with custom trace system by setting
MATTER_CUSTOM_TRACE to true and direct trace macros to
trace/MatterCustomTrace.h.

## How to add trace events

1. Include "trace/trace.h" in the source file.
Expand Down
8 changes: 8 additions & 0 deletions src/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#pragma once

#if defined(MATTER_CUSTOM_TRACE) && MATTER_CUSTOM_TRACE

#include "trace/MatterCustomTrace.h"

#else // MATTER_CUSTOM_TRACE

#if defined(PW_TRACE_BACKEND_SET) && PW_TRACE_BACKEND_SET

/* ignore GCC Wconversion warnings for pigweed */
Expand Down Expand Up @@ -69,3 +75,5 @@
#define MATTER_TRACE_EVENT_FUNCTION_FLAG(...) _MATTER_TRACE_EVENT_DISABLE(__VA_ARGS__)

#endif // defined(PW_TRACE_BACKEND_SET) && PW_TRACE_BACKEND_SET

#endif // defined(MATTER_CUSTOM_TRACE) && MATTER_CUSTOM_TRACE

0 comments on commit 1155768

Please sign in to comment.