-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Allow supplying org.slf4j.Marker #414
Conversation
/** Lazy add a log message if isTraceEnabled is true */ | ||
public fun KLogger.trace( | ||
throwable: Throwable? = null, | ||
marker: org.slf4j.Marker?, |
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.
Maybe I missed something, but why those methods needs to be added?
Anyway Marker.toSlf4j() will treat it correctly when the actual call happens, isn't it?
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.
I've added those extension methods as a convenience, so the user doesn't have to convert their org.slf4j.Marker
to io.github.oshai.kotlinlogging.Marker
manually.
If you think this is not desired, I can remove them from this PR.
What essentially happens is marker.toKotlinLogging().toSlf4j()
which is equivalent to marker
for the call to the underlying Logger.
(And if the underlying Logger is not Slf4j, it still behaves as a normal marker using the implementation of getName()
from org.slf4j.Marker
.)
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.
got it. I think I prefer to keep the api slim, not adding those extension methods. So it's better to remove from the PR.
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.
I've updated the PR accordingly.
import io.github.oshai.kotlinlogging.KotlinLogging | ||
import io.github.oshai.kotlinlogging.Level | ||
import io.github.oshai.kotlinlogging.Marker | ||
import io.github.oshai.kotlinlogging.* |
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.
please don't use star import
|
||
import io.github.oshai.kotlinlogging.Marker | ||
|
||
@JvmInline |
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.
I am not sure there is a real performance gain here from inline. it might even be the opposite because of boxing / unboxing. So unless there is an obvious reason I suggest to have it a regular class.
Thanks! |
…33) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.github.oshai:kotlin-logging-jvm](https://togithub.com/oshai/kotlin-logging) | `6.0.3` -> `6.0.4` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.oshai:kotlin-logging-jvm/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.oshai:kotlin-logging-jvm/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.oshai:kotlin-logging-jvm/6.0.3/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.oshai:kotlin-logging-jvm/6.0.3/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>oshai/kotlin-logging (io.github.oshai:kotlin-logging-jvm)</summary> ### [`v6.0.4`](https://togithub.com/oshai/kotlin-logging/releases/tag/6.0.4) [Compare Source](https://togithub.com/oshai/kotlin-logging/compare/6.0.3...6.0.4) #### What's Changed - Bump actions/cache from 3.3.3 to 4.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/395](https://togithub.com/oshai/kotlin-logging/pull/395) - Fluent Logging: Allow nullable values by [@​Zack-Freedman-Thoughtworks](https://togithub.com/Zack-Freedman-Thoughtworks) in [https://github.com/oshai/kotlin-logging/pull/402](https://togithub.com/oshai/kotlin-logging/pull/402) - Bump multiplatform from 1.9.22 to 1.9.23 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/405](https://togithub.com/oshai/kotlin-logging/pull/405) - Bump org.jetbrains.dokka from 1.9.10 to 1.9.20 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/406](https://togithub.com/oshai/kotlin-logging/pull/406) - Bump actions/cache from 4.0.0 to 4.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/403](https://togithub.com/oshai/kotlin-logging/pull/403) - Bump com.diffplug.spotless from 6.24.0 to 6.25.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/397](https://togithub.com/oshai/kotlin-logging/pull/397) - allow only markers being supplied by [@​ewoelfel](https://togithub.com/ewoelfel) in [https://github.com/oshai/kotlin-logging/pull/408](https://togithub.com/oshai/kotlin-logging/pull/408) - Upgrade ktfmt to version 0.47 by [@​mlewe](https://togithub.com/mlewe) in [https://github.com/oshai/kotlin-logging/pull/415](https://togithub.com/oshai/kotlin-logging/pull/415) - Allow supplying org.slf4j.Marker by [@​mlewe](https://togithub.com/mlewe) in [https://github.com/oshai/kotlin-logging/pull/414](https://togithub.com/oshai/kotlin-logging/pull/414) #### New Contributors - [@​Zack-Freedman-Thoughtworks](https://togithub.com/Zack-Freedman-Thoughtworks) made their first contribution in [https://github.com/oshai/kotlin-logging/pull/402](https://togithub.com/oshai/kotlin-logging/pull/402) - [@​ewoelfel](https://togithub.com/ewoelfel) made their first contribution in [https://github.com/oshai/kotlin-logging/pull/408](https://togithub.com/oshai/kotlin-logging/pull/408) - [@​mlewe](https://togithub.com/mlewe) made their first contribution in [https://github.com/oshai/kotlin-logging/pull/415](https://togithub.com/oshai/kotlin-logging/pull/415) **Full Changelog**: oshai/kotlin-logging@6.0.3...6.0.4 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Never, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/StefanLobbenmeier/yt-dlp-compose). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Thank you and thanks for the feedback :) |
….0.4 (#605) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.github.oshai:kotlin-logging-jvm](https://togithub.com/oshai/kotlin-logging) | `6.0.3` -> `6.0.4` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.oshai:kotlin-logging-jvm/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.oshai:kotlin-logging-jvm/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.oshai:kotlin-logging-jvm/6.0.3/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.oshai:kotlin-logging-jvm/6.0.3/6.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>oshai/kotlin-logging (io.github.oshai:kotlin-logging-jvm)</summary> ### [`v6.0.4`](https://togithub.com/oshai/kotlin-logging/releases/tag/6.0.4) [Compare Source](https://togithub.com/oshai/kotlin-logging/compare/6.0.3...6.0.4) #### What's Changed - Bump actions/cache from 3.3.3 to 4.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/395](https://togithub.com/oshai/kotlin-logging/pull/395) - Fluent Logging: Allow nullable values by [@​Zack-Freedman-Thoughtworks](https://togithub.com/Zack-Freedman-Thoughtworks) in [https://github.com/oshai/kotlin-logging/pull/402](https://togithub.com/oshai/kotlin-logging/pull/402) - Bump multiplatform from 1.9.22 to 1.9.23 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/405](https://togithub.com/oshai/kotlin-logging/pull/405) - Bump org.jetbrains.dokka from 1.9.10 to 1.9.20 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/406](https://togithub.com/oshai/kotlin-logging/pull/406) - Bump actions/cache from 4.0.0 to 4.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/403](https://togithub.com/oshai/kotlin-logging/pull/403) - Bump com.diffplug.spotless from 6.24.0 to 6.25.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/oshai/kotlin-logging/pull/397](https://togithub.com/oshai/kotlin-logging/pull/397) - allow only markers being supplied by [@​ewoelfel](https://togithub.com/ewoelfel) in [https://github.com/oshai/kotlin-logging/pull/408](https://togithub.com/oshai/kotlin-logging/pull/408) - Upgrade ktfmt to version 0.47 by [@​mlewe](https://togithub.com/mlewe) in [https://github.com/oshai/kotlin-logging/pull/415](https://togithub.com/oshai/kotlin-logging/pull/415) - Allow supplying org.slf4j.Marker by [@​mlewe](https://togithub.com/mlewe) in [https://github.com/oshai/kotlin-logging/pull/414](https://togithub.com/oshai/kotlin-logging/pull/414) #### New Contributors - [@​Zack-Freedman-Thoughtworks](https://togithub.com/Zack-Freedman-Thoughtworks) made their first contribution in [https://github.com/oshai/kotlin-logging/pull/402](https://togithub.com/oshai/kotlin-logging/pull/402) - [@​ewoelfel](https://togithub.com/ewoelfel) made their first contribution in [https://github.com/oshai/kotlin-logging/pull/408](https://togithub.com/oshai/kotlin-logging/pull/408) - [@​mlewe](https://togithub.com/mlewe) made their first contribution in [https://github.com/oshai/kotlin-logging/pull/415](https://togithub.com/oshai/kotlin-logging/pull/415) **Full Changelog**: oshai/kotlin-logging@6.0.3...6.0.4 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/pachli/pachli-android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This fixes #360.
./gradlew spotlessCheck
fails on this PR because of the ancient version of ktfmt used in the project (0.24).