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

utils: add functions to get and set logging levels for tpm2-tss #161

Closed
wants to merge 1 commit into from

Conversation

whooo
Copy link
Contributor

@whooo whooo commented Jun 6, 2021

Related to #49

I skipped support for TSS2_LOGFILE for now and due to how the logging works in libtss2 the loglevel can't be changed for a module as soon as that module have called a logging function

@codecov
Copy link

codecov bot commented Jun 6, 2021

Codecov Report

Merging #161 (c9089d7) into master (07a92e9) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
+ Coverage   87.81%   87.96%   +0.15%     
==========================================
  Files          13       13              
  Lines        3382     3416      +34     
  Branches      318      325       +7     
==========================================
+ Hits         2970     3005      +35     
  Misses        277      277              
+ Partials      135      134       -1     
Impacted Files Coverage Δ
tpm2_pytss/utils.py 87.50% <100.00%> (+4.94%) ⬆️
tpm2_pytss/FAPI.py 74.79% <0.00%> (+0.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07a92e9...c9089d7. Read the comment docs.

@joholl
Copy link
Contributor

joholl commented Jun 7, 2021

Cool, this is much needed!

I'm not sure if I forgot the fapijson log module or if it was added since then. We should add that.

@whooo
Copy link
Contributor Author

whooo commented Jun 7, 2021

@joholl, just pushed an update with fapijson and removed the "test" module as it only seems to be used for the tests

@joholl
Copy link
Contributor

joholl commented Jun 7, 2021

Hm, I thought about this a bit. I feel like a pythonic module should not write to stderr, at all. Instead, it should hand log records to the python standard lib logging module. This has many advantages: the user can have one log file for everything (including application-level logging), use the python log handlers and log levels, have one log format etc.

Have a look at draft #164.

Edit: as discussed in #164, this is solved best via callbacks. As for this PR: LGTM!

@whooo
Copy link
Contributor Author

whooo commented Jun 8, 2021

if something like tpm2-software/tpm2-tss#2087 is implemented I don't think this is needed

@whooo whooo closed this Jun 9, 2021
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 this pull request may close these issues.

2 participants