From 0c26f3bceb8494ad8bcc3d39a23b0464712ed385 Mon Sep 17 00:00:00 2001 From: Dinh Cong Toan Date: Tue, 20 Jul 2021 19:53:01 +0700 Subject: doc: update initial log level document Updating initial log level document Signed-off-by: Dinh Cong Toan --- doc/dlt_for_developers.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/doc/dlt_for_developers.md b/doc/dlt_for_developers.md index bedb802..09e2b87 100644 --- a/doc/dlt_for_developers.md +++ b/doc/dlt_for_developers.md @@ -387,14 +387,15 @@ environment variables are described: ### Initial Log level -The default log level of DLT User library is DLT\_LOG\_INFO. This can be changed +The default log level of DLT User library is DLT\_LOG\_INFO (when using macro +DLT\_REGISTER\_CONTEXT or dlt\_register\_context() api). This can be changed using a DLT client application (e.g. DLT Viewer). But there might be situations -where DEBUG or VERBOSE messages are needed before the DLT Daemon updated the -user library. +where DEBUG or VERBOSE messages are needed before the DLT Daemon updated the user library. -In this case DLT\_INITIAL\_LOG\_LEVEL can be exported. Using this environment -variable, the user can specify log level for contexts that will be used on -library startup. +There are several ways to initialize log level in DLT library startup phase. + +1. It is possible to do that by exporting environment variable DLT\_INITIAL\_LOG\_LEVEL. + By using this way, the user can specify log level for contexts. For example, an application "EXA1" has two contexts "CON1" and "CON2". For "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: > export DLT\_INITIAL\_LOG\_LEVEL=":CON1:2" +In case only the log level of context "CON1" of application "EXA1" shall be +initialized, and other contexts will be ignored, then: + +> export DLT\_INITIAL\_LOG\_LEVEL="::0;EXA1:CON1:2" + +2. If DLT\_INITIAL\_LOG\_LEVEL variable is not exported in the environment, +log level for it each context can be changed in the config file (/etc/dlt.conf). + +Default log level will be 4 (DLT\_LOG\_INFO) + +> ContextLogLevel = 4 + +3. DLT user can use dlt\_register\_context\_ll\_ts() api to initialize log +level for each context. + +Example: +> //Register new context to daemon, with initial log level is DLT\_LOG\_VERBOSE +> +> dlt\_register\_context\_ll\_ts(&con\_exa1, "CON", "First context", DLT\_LOG\_VERBOSE, DLT\_TRACE\_STATUS\_OFF); + +The priority of context log level would be as follows: +- Priority 1: Using dlt\_register\_context\_ll\_ts() api +- Priority 2: Using environment variable DLT\_INITIAL\_LOG\_LEVEL +- Priority 3: Setting in config file dlt.conf + ### Local print mode Sometimes it might be useful to print DLT messages for debugging directly to -- cgit v1.2.1