cookiecutter-scverse icon indicating copy to clipboard operation
cookiecutter-scverse copied to clipboard

Unified logging and settings

Open grst opened this issue 3 years ago • 6 comments

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.

grst avatar Jun 07 '22 14:06 grst

Big yes.

Zethson avatar Jun 07 '22 14:06 Zethson

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

grst avatar Jun 21 '22 16:06 grst

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 avatar Oct 10 '22 03:10 adamgayoso

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

adamgayoso avatar Oct 11 '22 18:10 adamgayoso

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

flying-sheep avatar Oct 20 '22 10:10 flying-sheep