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

Support for a safe way to defer logging on the happy path #834

Closed
morgen-peschke opened this issue Apr 30, 2024 · 0 comments
Closed

Support for a safe way to defer logging on the happy path #834

morgen-peschke opened this issue Apr 30, 2024 · 0 comments

Comments

@morgen-peschke
Copy link
Contributor

morgen-peschke commented Apr 30, 2024

A "that would be nice" feature that's come up occasionally when discussing logging is the ability to log only when an error condition is encountered.

We can get basically this in tests using TestingLogger/StructuredTestingLogger and it would be really handy to be able to do this in production code as well.

I think there's a path to a reasonable implementation using Ref, but I'm not sure if there isn't a more elegant way to handle a logger's lifecycle (particularly in the context of an http4s request).

I haven't poked at how this would work with LoggerFactory, which may have it's own complications.

morgen-peschke added a commit to morgen-peschke/log4cats that referenced this issue Apr 30, 2024
Open questions:
1. Is there a better way to do this?
2. Can this be made to work with LoggerFactory?

Related to Issue typelevel#834
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

1 participant