You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/FEATURE_COMMON_PAL/mbed-trace/README.md
+10-8Lines changed: 10 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ The purpose of the library is to provide a light, simple and general tracing sol
33
33
34
34
```
35
35
[DBG ][abc ]: This is a debug message from module abc<cr><lf>
36
-
[ERR ][abc ]: Something goes wrong in module abc<cr><lf>
37
-
[WARN][br ]: Oh no, br warning occurs!<cr><lf>
38
36
[INFO][br ]: Hi there.<cr><lf>
37
+
[WARN][br ]: Oh no, br warning occurs!<cr><lf>
38
+
[ERR ][abc ]: Something goes wrong in module abc<cr><lf>
39
39
```
40
40
41
41
## Usage
@@ -47,8 +47,10 @@ The purpose of the library is to provide a light, simple and general tracing sol
47
47
* To enable the tracing API:
48
48
* With yotta: set `YOTTA_CFG_MBED_TRACE` to 1 or true. Setting the flag to 0 or false disables tracing.
49
49
*[With mbed OS 5](#enabling-the-tracing-api-in-mbed-os-5)
50
-
* By default, trace uses 1024 bytes buffer for trace lines, but you can change it by yotta with: `YOTTA_CFG_MBED_TRACE_LINE_LENGTH`.
51
-
* To disable the IPv6 conversion, set `YOTTA_CFG_MBED_TRACE_FEA_IPV6 = 0`.
50
+
* By default, trace uses 1024 bytes buffer for trace lines, but you can change it by setting the configuration macro `MBED_TRACE_LINE_LENGTH` to the desired value.
51
+
* To disable the IPv6 conversion:
52
+
* With yotta: set `YOTTA_CFG_MBED_TRACE_FEA_IPV6 = 0`.
53
+
* With mbed OS 5: set `MBED_CONF_MBED_TRACE_FEA_IPV6 = 0`.
52
54
* If thread safety is needed, configure the wait and release callback functions before initialization to enable the protection. Usually, this needs to be done only once in the application's lifetime.
53
55
* Call the trace initialization (`mbed_trace_init`) once before using any other APIs. It allocates the trace buffer and initializes the internal variables.
54
56
* Define `TRACE_GROUP` in your source code (not in the header!) to use traces. It is a 1-4 characters long char-array (for example `#define TRACE_GROUP "APPL"`). This will be printed on every trace line.
@@ -82,9 +84,9 @@ When you want to print traces, use the `tr_<level>` macros. The macros behave li
82
84
Available levels:
83
85
84
86
* debug
87
+
* info
85
88
* warning
86
89
* error
87
-
* info
88
90
* cmdline (special behavior, should not be used)
89
91
90
92
For the thread safety, set the mutex wait and release functions. You need do this before the initialization to have the functions available right away:
@@ -128,7 +130,7 @@ See more in [mbed_trace.h](https://github.com/ARMmbed/mbed-trace/blob/master/mbe
128
130
## Usage example:
129
131
130
132
```c++
131
-
#define YOTTA_CFG_MBED_TRACE 1 //this can be defined also in the yotta configuration file config.json
133
+
#define MBED_CONF_MBED_TRACE_ENABLE 1 //this could be defined also in the mbed-cli configuration file mbed_app.json
132
134
#include "mbed-trace/mbed_trace.h"
133
135
#define TRACE_GROUP "main"
134
136
@@ -148,9 +150,9 @@ int main(void){
148
150
mbed_trace_mutex_release_function_set( my_mutex_release ); // only if thread safety is needed
149
151
mbed_trace_init(); // initialize the trace library
150
152
tr_debug("this is debug msg"); //-> "[DBG ][main]: this is a debug msg"
151
-
tr_err("this is error msg"); //-> "[ERR ][main]: this is an error msg"
152
-
tr_warn("this is warning msg"); //-> "[WARN][main]: this is a warning msg"
153
153
tr_info("this is info msg"); //-> "[INFO][main]: this is an info msg"
154
+
tr_warn("this is warning msg"); //-> "[WARN][main]: this is a warning msg"
155
+
tr_err("this is error msg"); //-> "[ERR ][main]: this is an error msg"
0 commit comments