-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add LoggerFactory typeclass #629
Conversation
The reasoning for this commit is that I want to avoid having a Sync instance just for being able to log in a http4s api. Extract LoggerName from macro and make it an implicit. This makes it easier to have forwarders to Slf4jLogger. This should be binary compatible, I had to add some exclusions to mima because of the missing macro methods.
slf4j/src/main/scala-2/org/typelevel/log4cats/slf4j/Slf4jLogger.scala
Outdated
Show resolved
Hide resolved
This also resolves #492. I can say that there are uncounted requests on it from TF-folks. So it's nice to see this PR 👍🏻 |
slf4j/src/main/scala-2/org/typelevel/log4cats/slf4j/Slf4jLogger.scala
Outdated
Show resolved
Hide resolved
slf4j/src/main/scala-2/org/typelevel/log4cats/slf4j/Slf4jLoggerFactory.scala
Outdated
Show resolved
Hide resolved
slf4j/src/main/scala-2/org/typelevel/log4cats/slf4j/internal/GetLoggerMacros.scala
Outdated
Show resolved
Hide resolved
slf4j/src/main/scala-3/org/typelevel/log4cats/slf4j/Slf4jLoggerFactory.scala
Outdated
Show resolved
Hide resolved
slf4j/src/main/scala-3/org/typelevel/log4cats/slf4j/Slf4jLoggerFactory.scala
Outdated
Show resolved
Hide resolved
* Extract Platform traits for different code * LoggerName moved to shared * LoggerFactory with convenience methods.
slf4j/src/main/scala/org/typelevel/log4cats/slf4j/LoggerFactory.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this!
slf4j/src/main/scala-2/org/typelevel/log4cats/slf4j/LoggerNamePlatform.scala
Outdated
Show resolved
Hide resolved
slf4j/src/test/scala/org/typelevel/log4cats/slf4j/LoggerNameTest.scala
Outdated
Show resolved
Hide resolved
slf4j/src/main/scala/org/typelevel/log4cats/slf4j/LoggerName.scala
Outdated
Show resolved
Hide resolved
* Extracted LoggerFactory and LoggerFactoryGen * Moved LoggerName to core and added macro there * Renamed Platform traits to Compat traits * Moved Slf4jLoggerFactory into Sl4j4Logger.Factory trait
slf4j/src/main/scala/org/typelevel/log4cats/slf4j/Slf4jLogger.scala
Outdated
Show resolved
Hide resolved
This reverts commit 7167e54.
trait LoggerFactory[F[_]] extends LoggerFactoryGen[F, SelfAwareStructuredLogger[F]] | ||
object LoggerFactory extends LoggerFactoryCompanion { | ||
def apply[F[_]: LoggerFactory]: LoggerFactory[F] = implicitly | ||
trait LoggerFactory[F[_]] extends LoggerFactoryGen[F] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can consider dropping this, since LoggerFactoryGen now has everything that is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kinda convinient for users who would like to use just LoggerFactory
without the need to define LoggerType explicitly
Any chance this can get merged? @ChristopherDavenport ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fully backwards compatible so this would be a minor version right?
That is correct. There are no mima issues or exclusions here |
This seems awesome, thanks for the hardwork! I definitely wouldn't want to block this, but is there any chance a bit of documentation could be added, or an example of how one might use this? |
Going to roll this out tomorrow. Really awesome work. |
The reasoning for this PR is that I want to avoid having a Sync instance just for being able to log in a http4s api.
Extract LoggerName from macro and make it an implicit.
This makes it easier to have forwarders to Slf4jLogger.
This should be binary compatible.