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

Slf4j bridge #202

Merged
merged 4 commits into from
Jan 2, 2021
Merged

Slf4j bridge #202

merged 4 commits into from
Jan 2, 2021

Conversation

vigoo
Copy link
Contributor

@vigoo vigoo commented Jan 2, 2021

This PR adds a new module called zio-logging-slf4j-bridge, which is the "opposite" of the existing SLF4j support, registering zio-logging as an SLF4j provider.
With this third party libraries logging through SLF4j can log through zio-logging without the need to a third party slf4j implementation.

This is good for reducing dependencies and simplify the whole logging stack of services.
For example we are using this for mixing in sttp and Netty logs to the zio-logging log stream of a service.

Easy filtering configuration makes this much more usable, a proposed solution for that is coming in another PR.

@vigoo vigoo requested review from mijicd and softinio as code owners January 2, 2021 12:28
@pshemass pshemass self-requested a review January 2, 2021 16:31
@pshemass
Copy link
Collaborator

pshemass commented Jan 2, 2021

Thanks @vigoo for this PR it looks pretty good.

@pshemass pshemass merged commit 008fc75 into zio:master Jan 2, 2021
@vigoo vigoo deleted the slf4j-bridge branch January 2, 2021 17:00
def attachRuntime(runtime: zio.Runtime[Logging]): Unit =
this.runtime = runtime

private[impl] def run[A](f: ZIO[Logging, Nothing, A]): Unit =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the A type parameter and accept ZIO[Logging, Nothing, Any], instead. Clearer expression of the same idea.

}

object ZioLoggerFactory {
def bind(runtime: zio.Runtime[Logging]): Unit =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialize?

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.

3 participants