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

go-tuf logs to stdout/stderr when used as a library #376

Closed
tamird opened this issue Sep 8, 2022 · 6 comments · Fixed by #385
Closed

go-tuf logs to stdout/stderr when used as a library #376

tamird opened this issue Sep 8, 2022 · 6 comments · Fixed by #385

Comments

@tamird
Copy link
Contributor

tamird commented Sep 8, 2022

Internal operations log directly to stdout/stderr starting with #160.

It would be preferable not to interact with stdout/stderr except from within cmd/.

@asraa
Copy link
Contributor

asraa commented Sep 8, 2022

I agree! We get logging from libraries. Repo commands can be logged directly from the cmd/.

We can make sure there is no logging done in repo.go or pkg/

What about our deprecated code? I think it's ok to remove the logging that you are using a deprecated key, since libraries will obviously import them proactively.

github-actions bot pushed a commit to gnoliyil/fuchsia that referenced this issue Sep 8, 2022
Pin go-tuf; see theupdateframework/go-tuf#376.

Change-Id: Ifcb868e250214e64e8c5f032331fb839c707297e
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/722630
Fuchsia-Auto-Submit: Tamir Duberstein <[email protected]>
Reviewed-by: Evan Wildenhain <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
@joshuagl
Copy link
Member

joshuagl commented Sep 9, 2022

Thanks for filing this, and for the suggestion in #160 (comment)

Would it be possible to thread an io.Writer through rather than calling fmt.Print{f,ln} directly?

That's a good suggestion. I think we want to:

  • switch from fmt.Print{f,ln} to log.Print{f,ln}
  • take an optional io.Writer in library code (notably repo.go) so the caller can choose where the logging messages go

@asraa
Copy link
Contributor

asraa commented Sep 14, 2022

I'm going to prioritize this and take this on: cosign users are complaining :)

@asraa
Copy link
Contributor

asraa commented Sep 16, 2022

So currently I'm piping an optional logger through the client.

I would like to only log the tuf ecdsa deprecated message once per client. that would maybe require a singleton in the client for that message? that feels sorta messy. anyone have any other nice go suggestions?

@trishankatdatadog
Copy link
Member

anyone have any other nice go suggestions?

@ethan-lowman-dd wdyt?

@asraa
Copy link
Contributor

asraa commented Sep 16, 2022

It could be that we don't care at all for repeated lines now that we can divert the logs to a file!

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.

4 participants