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

Support LogBuilder API in a kotlin-y way #36

Open
rocketraman opened this issue Sep 9, 2023 · 0 comments
Open

Support LogBuilder API in a kotlin-y way #36

rocketraman opened this issue Sep 9, 2023 · 0 comments
Labels
api Issues or pull requests that affect the API

Comments

@rocketraman
Copy link
Member

rocketraman commented Sep 9, 2023

The Kotlin API does not have an equivalent to the https://logging.apache.org/log4j/2.x/manual/logbuilder.html.

A Kotlin-y approach may use a DSL rather than a builder. For example, a LoggingScope passed as a lambda receiver could result in an API that could look something like:

logger.atError {
  // `this` here is an instance of `LoggingScope`
  // everything optional except log
  throwable = ...
  marker = ...
  location = ...
  log = ...
}

The standard builder API could also be supported as an alternative for users who prefer it.

See also relevant background discussion about designing a fluent logging API from https://github.com/google/flogger and https://google.github.io/flogger/benefits.

@jvz jvz added the api Issues or pull requests that affect the API label Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues or pull requests that affect the API
Projects
None yet
Development

No branches or pull requests

2 participants