typelevel / log4cats

Logging Tools For Interaction with cats-effect
https://typelevel.org/log4cats/
Apache License 2.0
400 stars 73 forks source link

Quality of life updates for LoggerFactory #825

Closed morgen-peschke closed 5 months ago

morgen-peschke commented 5 months ago

Adds methods to return updated versions that configure the loggers they produce using addContext and withModifiedString.

This should make it easier to migrate from passing around a single SelfAwareStructuredLogger and using a LoggerFactory.

morgen-peschke commented 5 months ago

I don't know what the LoggerFactoryGen supertype is for, but I'll ask: would this have worked on LoggerFactoryGen? I think probably not, because then it wouldn't be able to return a LoggerFactory?

Assuming that's a bad idea, 👍

I'm pretty sure that it couldn't go on LoggerFactoryGen because they get passed through to methods which aren't on Logger, so we need the constraint that LoggerFactory adds that LoggerFactoryGen#LoggerType is SelfAwareStructuredLogger[F] instead of any Logger[F] subtype.