You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed some libraries, e.g. http4s, use LoggerFactory as context bound a lot even though all they need is a factory for a Logger, not for a SelfAwareStructuredLogger.
This means users of such libraries are force to provide instances of SelfAwareStructuredLogger even though the extra methods of SelfAwareLogger and StructuredLogger are not used at all. That makes it unneccessarily hard to use other logging frameworks than those supported by log4cats directly.
I guess the reasons why libraries use LoggerFactory as context bound when they only need a factory for a simple Logger are:
LoggerFactoryGen (which would allow to return a Loggerinstead of a SelfAwareStructuredLogger) has a less inviting name than LoggerFactory
a bunch of convenience stuff that is defined for LoggerFactory (e.g. mapK and implicit conversion like optionTFactory, eitherTFactory, ...) is not defined for LoggerFactoryGen
The "less inviting name" part probably cannot be changed without breaking everyone's code, so my proposal is to address the other reason and provide as much of the convenience stuff that is available for LoggerFactory for LoggerFactoryGen as possible.
The text was updated successfully, but these errors were encountered:
I noticed some libraries, e.g. http4s, use
LoggerFactory
as context bound a lot even though all they need is a factory for aLogger
, not for aSelfAwareStructuredLogger
.This means users of such libraries are force to provide instances of
SelfAwareStructuredLogger
even though the extra methods ofSelfAwareLogger
andStructuredLogger
are not used at all. That makes it unneccessarily hard to use other logging frameworks than those supported by log4cats directly.I guess the reasons why libraries use
LoggerFactory
as context bound when they only need a factory for a simpleLogger
are:LoggerFactoryGen
(which would allow to return aLogger
instead of aSelfAwareStructuredLogger
) has a less inviting name thanLoggerFactory
LoggerFactory
(e.g.mapK
and implicit conversion likeoptionTFactory
,eitherTFactory
, ...) is not defined forLoggerFactoryGen
The "less inviting name" part probably cannot be changed without breaking everyone's code, so my proposal is to address the other reason and provide as much of the convenience stuff that is available for
LoggerFactory
forLoggerFactoryGen
as possible.The text was updated successfully, but these errors were encountered: