Skip to content

Commit 0c26f3b

Browse files
tdinhcongssugiura
authored andcommitted
doc: update initial log level document
Updating initial log level document Signed-off-by: Dinh Cong Toan <[email protected]>
1 parent 0d36bba commit 0c26f3b

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

doc/dlt_for_developers.md

+32-6
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,15 @@ environment variables are described:
387387

388388
### Initial Log level
389389

390-
The default log level of DLT User library is DLT\_LOG\_INFO. This can be changed
390+
The default log level of DLT User library is DLT\_LOG\_INFO (when using macro
391+
DLT\_REGISTER\_CONTEXT or dlt\_register\_context() api). This can be changed
391392
using a DLT client application (e.g. DLT Viewer). But there might be situations
392-
where DEBUG or VERBOSE messages are needed before the DLT Daemon updated the
393-
user library.
393+
where DEBUG or VERBOSE messages are needed before the DLT Daemon updated the user library.
394394

395-
In this case DLT\_INITIAL\_LOG\_LEVEL can be exported. Using this environment
396-
variable, the user can specify log level for contexts that will be used on
397-
library startup.
395+
There are several ways to initialize log level in DLT library startup phase.
396+
397+
1. It is possible to do that by exporting environment variable DLT\_INITIAL\_LOG\_LEVEL.
398+
By using this way, the user can specify log level for contexts.
398399

399400
For example, an application "EXA1" has two contexts "CON1" and "CON2". For
400401
"CON1" log level DEBUG and for "CON2" log level VERBOSE shall be used. The
@@ -414,6 +415,31 @@ If the log level of context "CON1" shall be initialized, then:
414415

415416
> export DLT\_INITIAL\_LOG\_LEVEL=":CON1:2"
416417
418+
In case only the log level of context "CON1" of application "EXA1" shall be
419+
initialized, and other contexts will be ignored, then:
420+
421+
> export DLT\_INITIAL\_LOG\_LEVEL="::0;EXA1:CON1:2"
422+
423+
2. If DLT\_INITIAL\_LOG\_LEVEL variable is not exported in the environment,
424+
log level for it each context can be changed in the config file (/etc/dlt.conf).
425+
426+
Default log level will be 4 (DLT\_LOG\_INFO)
427+
428+
> ContextLogLevel = 4
429+
430+
3. DLT user can use dlt\_register\_context\_ll\_ts() api to initialize log
431+
level for each context.
432+
433+
Example:
434+
> //Register new context to daemon, with initial log level is DLT\_LOG\_VERBOSE
435+
>
436+
> dlt\_register\_context\_ll\_ts(&con\_exa1, "CON", "First context", DLT\_LOG\_VERBOSE, DLT\_TRACE\_STATUS\_OFF);
437+
438+
The priority of context log level would be as follows:
439+
- Priority 1: Using dlt\_register\_context\_ll\_ts() api
440+
- Priority 2: Using environment variable DLT\_INITIAL\_LOG\_LEVEL
441+
- Priority 3: Setting in config file dlt.conf
442+
417443
### Local print mode
418444

419445
Sometimes it might be useful to print DLT messages for debugging directly to

0 commit comments

Comments
 (0)