Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: set TSS log level per logging module #49

Open
joholl opened this issue Dec 4, 2020 · 4 comments
Open

Feature Request: set TSS log level per logging module #49

joholl opened this issue Dec 4, 2020 · 4 comments

Comments

@joholl
Copy link
Contributor

joholl commented Dec 4, 2020

Unfortunately, there seems to be no mechanism to set the TSS log level at runtime besides via the env variable TSS2_LOG, e.g. TSS2_LOG=all+ERROR,fapi+TRACE, as documented here. What do you think of having a function setting this variable, maybe from a dict?

Example:

log_levels = { "all": "error", "tcti": "trace"}
log_levels_str = ",".join(f"{k}+{v}" for k, v in log_levels.items())  # 'all+error,tcti+trace'
os.environ["TSS2_LOG"] = log_levels_str

We might want to use enums instead of strings(?). In case you wonder, modules and log levels are parsed case insensitive.

Complete list of TSS log levels (as defined here):

  • none
  • (unused) [note: defined with parens]
  • ERROR
  • WARNING
  • info
  • debug
  • trace

Complete list of TSS log modules (grepped):

  • fapi
  • esys
  • esys_crypto
  • sys
  • marshal
  • tcti
  • log
  • test
  • all [note: covers all modules]
@johnandersen777
Copy link
Member

Sweet. I'm doing a major re-write at the moment. I'll make sure to get this in there. Thanks!

@williamcroberts
Copy link
Member

We don;t have a log in the rewrite to CFFI yet, but we will add it.

@williamcroberts williamcroberts added this to the 1.0 Release milestone Mar 4, 2021
@joholl
Copy link
Contributor Author

joholl commented Mar 9, 2021

Nice, I did some preliminary work on this. That includes an (already merged) PR for redirecting logging to a file (which could be a pipe) on TSS side, see tpm2-software/tpm2-tss#1976

@williamcroberts
Copy link
Member

I don't think this is going to make 1.0 and we need to finalize the tss C code approach. We can't do per-ctx logging because much of the submodules don't have context parameters, like libmu.

See:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants