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.
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.