md_doc_logging.3 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .TH "md_doc_logging" 3 "Fri Oct 7 2022" "Version 3.2.0" "tpm2-tss" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. md_doc_loggingCompile time log levels
  6. \- At compile time the maximum log level can be specified\&. This allows distros to disable the overhead code and reduce overall code size\&.
  7. .PP
  8. .SH "Runtime log level"
  9. .PP
  10. .PP
  11. At runtime, the log level is determined by an environment variable\&. The default log level is WARNING\&. The level can be changed by setting the \fCTSS2_LOG\fP environment variable\&.
  12. .PP
  13. Possible levels are: NONE, ERROR, WARNING, INFO, DEBUG, TRACE
  14. .PP
  15. The level can be set for all module using the \fCall\fP module name or individually per module\&. The environment variable is evaluated left to right\&.
  16. .PP
  17. Example: \fCTSS2_LOG=all+ERROR,marshal+TRACE,tcti+DEBUG\fP
  18. .PP
  19. .SH "Log file"
  20. .PP
  21. .PP
  22. By default, logs are written to standard error (\fCstderr\fP)\&. If the environment variable \fCTSS2_LOGFILE\fP is set, the TSS will log to the file at the given path instead\&. If the file does not yet exist, it will be created\&. Otherwise, the TSS will append to it\&.
  23. .PP
  24. The special value \fCstderr\fP will result in default behavior while \fCstdout\fP and \fC-\fP will have the TSS write to standard output\&.
  25. .PP
  26. .SH "Implementation"
  27. .PP
  28. .PP
  29. Each source code file specifies its corresponding module before including log\&.h\&.
  30. .PP
  31. .nf
  32. #define LOGMODULE tcti
  33. #include "log\&.h"
  34. .fi
  35. .PP
  36. Optionally, the default log-level for this module can be set:
  37. .PP
  38. .nf
  39. #define LOGMODULE tcti
  40. #define LOGDEFAULT ERROR
  41. #include "log\&.h"
  42. .fi
  43. .PP