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

Add LoggerFactory typeclass #629

Merged
merged 15 commits into from
Apr 21, 2022
Merged

Conversation

hamnis
Copy link
Contributor

@hamnis hamnis commented Mar 24, 2022

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.

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.
@danicheg
Copy link
Member

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 👍🏻

* Extract Platform traits for different code
* LoggerName moved to shared
* LoggerFactory with convenience methods.
@ivan-klass ivan-klass mentioned this pull request Mar 24, 2022
Copy link
Member

@danicheg danicheg left a 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!

* Extracted LoggerFactory and LoggerFactoryGen
* Moved LoggerName to core and added macro there
* Renamed Platform traits to Compat traits
* Moved Slf4jLoggerFactory into Sl4j4Logger.Factory trait
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] {
Copy link
Contributor Author

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.

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

@hamnis
Copy link
Contributor Author

hamnis commented Apr 15, 2022

Any chance this can get merged? @ChristopherDavenport ?

Copy link
Member

@ChristopherDavenport ChristopherDavenport left a 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?

@hamnis
Copy link
Contributor Author

hamnis commented Apr 16, 2022

That is correct. There are no mima issues or exclusions here

@valencik
Copy link
Member

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?

@ChristopherDavenport
Copy link
Member

Going to roll this out tomorrow. Really awesome work.

@ChristopherDavenport ChristopherDavenport merged commit 1c43278 into typelevel:main Apr 21, 2022
@hamnis hamnis deleted the logger-factory branch April 21, 2022 06:18
@danicheg
Copy link
Member

@valencik If you're interested in docs, you might dig into fresh PR #642. It's not utter but may give some insights.

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

Successfully merging this pull request may close these issues.

7 participants