Skip to content

Commit d11327e

Browse files
committed
Merge branch 'master' into devel
2 parents 9385471 + be0cb5b commit d11327e

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

docs/TriceUserManual.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6466,11 +6466,11 @@ This use case is not expected for most cases, but mentioned here to show the pos
64666466

64676467
```C
64686468
88 | ...
6469-
89 | trice("info:hi");
6470-
90 |
6471-
91 | #define XSTR(x) STR(x)
6472-
92 | #define STR(x) #x
6473-
93 |
6469+
89 | #define XSTR(x) STR(x)
6470+
90 | #define STR(x) #x
6471+
91 |
6472+
92 | trice("info:hi");
6473+
93 |
64746474
94 | #define TRICE_ETC "xyz"
64756475
95 | #pragma message "$usr0=" XSTR(TRICE_ETC)
64766476
96 | trice("info:hi");
@@ -6514,7 +6514,7 @@ The structured log output would be:
65146514

65156515
```bash
65166516
{...}
6517-
{"level":"info","loc":"main.c:89","fmt":"hi","etc":""}
6517+
{"level":"info","loc":"main.c:92","fmt":"hi","etc":""}
65186518
{"level":"info","loc":"main.c:96","fmt":"hi","etc":"xyz"}
65196519
{"level":"info","loc":"main.c:100","fmt":"hi","etc":""}
65206520
{"level":"info","loc":"main.c:104","fmt":"hi","etc":"abc"}
@@ -6563,11 +6563,11 @@ To achieve a log output in compact JSON with line as string we can use:
65636563

65646564
```bash
65656565
trice insert \
6566-
-stf='{"level":"%-6s","file":"%24s","line:"%5s","func":"%-16s","taskID":"%04x","fmt":$fmt,"uptime":%08u us"}' \
6567-
-stv='$level, $file, $line, $func, getTaskID(), $values, uptime()'
6566+
-stf='{"level":"$level","file":"$file","line:"$line","taskID":"%04x","fmt":$fmt,"uptime":%08u us"}' \
6567+
-stv='getTaskID(), $values, uptime()'
65686568
```
65696569

6570-
To put things together. Any structured format string design is possible and the user can insert the $line (example) value:
6570+
**To put things together:** Any structured format string design is possible and the user can insert the $line (example) value:
65716571

65726572
* directly as string (fastest execution, straight forward)
65736573
* indirectly as formatted string (fastest execution alignment option)
@@ -6578,7 +6578,7 @@ After `trice insert` we get this (compact JSON) log line according to `-stf` and
65786578
```C
65796579
void doStuff( void ){
65806580
// ...
6581-
trice(iD(789), "{\"level\":\"info \",\"file\":\" val.c\",\"line\":\" 321\",\"func\":\"doStuff \",\"taskID\":\"%04x\",\"fmt\":\"The answer is %d.\",\"uptime\":\"%08u us\"}\n', getTaskID(), 42, uptime());
6581+
trice(iD(789), "{\"level\":\"info\",\"file\":\"val.c\",\"line\":\"321\",\"taskID\":\"%04x\",\"fmt\":\"The answer is %d.\",\"uptime\":\"%08u us\"}\n', getTaskID(), 42, uptime());
65826582
// ...
65836583
}
65846584
```
@@ -6601,35 +6601,35 @@ The appropriate Trice tool log line output would be similar to
66016601

66026602
```bash
66036603
{...}
6604-
{"level":"info ","file":" val.c","line":" 321","func":"doStuff ","taskID":"0123","fmt":"The answer is 42.","uptime":"12345678 us"}
6604+
{"level":"info","file":"val.c","line":"321","taskID":"0123","fmt":"The answer is 42.","uptime":"12345678 us"}
66056605
{...}
66066606
```
66076607

6608-
When *stf* and *stv* are empty strings (default), `trice insert` and `trice clean` commands will work the ususal way. If they are not empty, the `trice insert` command will on each Trice statement use a heuristic to check if the context information was inserted already and update it or otherwise insert it. **ATTENTION:** That will work only if *stf* and *stv* where not changed by the user inbetween. The same way `trice clean` would remove the context information only, if *stf* and *stv* kept unchanged. If the user wants to change *stf* and *stv* during development, first a `trice clean` is needed. Use a `build.sh` script like this:
6608+
When *stf* and *stv* are empty strings (default), `trice insert` and `trice clean` commands will work the ususal way. If they are not empty, the `trice insert` command will on each Trice statement use a heuristic to check if the context information was inserted already and update it or otherwise insert it. **ATTENTION:** That will work only, if *stf* and *stv* where not changed by the user inbetween. In the same way `trice clean` would remove the context information only, if *stf* and *stv* kept unchanged. If the user wants to change *stf* and *stv* during development, first a `trice clean` is needed. Use a `build.sh` script like this:
66096609

66106610
```bash
66116611
#!/bin/bash
66126612

6613-
# Run "rm -rf ~/.trice/cache/*", after modifying $SLFMT and SLVAL !!!
6613+
# Run "rm -rf ~/.trice/cache/*" automatically after changing this file !!!
66146614

6615-
SLFMT='{"level":"%-6s","file":"%24s","line:"%5d","func":"%-16s","taskID":"%x","fmt":"$fmt","uptime":"%08u us"}'
6616-
SLVAL='$level, $file, $line, $func, getTaskID(), $values, uptime()'
6615+
STF='{"level":"$level","file":"$file","line:"$line","taskID":"%04x","fmt":$fmt,"uptime":%08u us"}'
6616+
STV='getTaskID(), $values, uptime()'
66176617

6618-
trice insert -cache -stf="$SLFMT" -stv="$SLVAL"
6618+
trice insert -cache -stf="$STF" -stv="$STV"
66196619
# make
6620-
trice clean -cache -stf="$SLFMT" -stv="$SLVAL"
6620+
trice clean -cache -stf="$STF" -stv="$STV"
66216621
```
66226622

66236623
The `-cache` switch is still experimental - to stay safe use (here again with `$line` as string):
66246624

66256625
```bash
66266626
#!/bin/bash
6627-
SLFMT='{"level":"%-6s","file":"%24s","line:"%5s","func":"%-16s","taskID":"%x","fmt":"$fmt","uptime":"%08u us"}'
6628-
SLVAL=', $line, getTaskID(), $values, uptime()'
6627+
STF='{"level":"$level","file":"$file","line:"$line","taskID":"%04x","fmt":$fmt,"uptime":%08u us"}'
6628+
STV='getTaskID(), $values, uptime()'
66296629

6630-
trice insert -stf="$SLFMT" -stv="$SLVAL"
6630+
trice insert -stf="$STF" -stv="$STV"
66316631
# make
6632-
trice clean -stf="$SLFMT" -stv="$SLVAL"
6632+
trice clean -stf="$STF" -stv="$STV"
66336633
```
66346634

66356635
## 46. <a id='trice-user-manual-changelog'></a>Trice User Manual Changelog

0 commit comments

Comments
 (0)