xref: /aosp_15_r20/external/tpm2-tss/doc/logging.md (revision 758e9fba6fc9adbf15340f70c73baee7b168b1c9)
1# Compile time log levels
2
3At compile time the maximum log level can be specified. This allows distros to
4disable the overhead code and reduce overall code size.
5
6# Runtime log level
7
8At runtime, the log level is determined by an environment variable. The default
9log level is WARNING. The level can be changed by setting the TSS2_LOG
10environment variable.
11
12Possible levels are: NONE, ERROR, WARNING, INFO, DEBUG, TRACE
13
14The level can be set for all module using the `all` module name or individually
15per module. The environment variable is evaluated left to right.
16
17Example: `TSS2_LOG=all+ERROR,marshal+TRACE,tcti+DEBUG`
18
19# Implementation
20
21Each source code file specifies its corresponding module before including log.h.
22```
23#define LOGMODULE tcti
24#include "log.h"
25```
26Optionally, the default log-level for this module can be set:
27```
28#define LOGMODULE tcti
29#define LOGDEFAULT ERROR
30#include "log.h"
31```
32