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

Unified logging and settings #72

Open
grst opened this issue Jun 7, 2022 · 5 comments
Open

Unified logging and settings #72

grst opened this issue Jun 7, 2022 · 5 comments

Comments

@grst
Copy link
Collaborator

grst commented Jun 7, 2022

Should we propose a default mechanism for logging and settings?

Benefits IMO would be consistent behaviour for all ecosystem packages. Ideally there would be a way to set the logging level for all scverse packages globally.

This could either be implemented as

  • a bunch of vendored code
  • a separate "scverse-tools" package that can be imported as dependency.

In the long run, a "scverse-tools" package could make sense. We kinda have something like that already with scanpydoc, but could extend the scope to other helper functions.

@Zethson
Copy link
Member

Zethson commented Jun 7, 2022

Big yes.

@grst
Copy link
Collaborator Author

grst commented Jun 21, 2022

Should include a function to get the session_info as in
scanpy.loggin.print_versions()

@adamgayoso
Copy link
Member

We should likely just use the standard logging module? We have a very basic setup with scvi-tools that uses rich to format the messages.

@adamgayoso
Copy link
Member

https://github.com/Delgan/loguru looks interesting also

@flying-sheep
Copy link
Member

flying-sheep commented Oct 20, 2022

Another interesting alternative that looks easier to understand (less magic API) and just as easy to use while encouraging to attach data to your log entries: https://www.structlog.org/en/stable/getting-started.html

If you have rich or better-exceptions installed, exceptions will be rendered in colors and with additional helpful information.

It also promotes logging json by default if the stdlib isn’t a TTY which I really like: https://www.structlog.org/en/stable/logging-best-practices.html#pretty-printing-vs-structured-output

See here how it integrates with the stdlib: https://www.structlog.org/en/stable/getting-started.html#structlog-and-standard-library-s-logging

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

No branches or pull requests

4 participants