-
-
Notifications
You must be signed in to change notification settings - Fork 111
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 turning off logging with Level.OFF
#313
Conversation
the PR lgtm thanks! |
Got it, I'll give it a go when I have a few more minutes to spare. Feel free to push to this branch if you manage to get to it before I do. |
9f5b223
to
a32434b
Compare
a32434b
to
1b4acf7
Compare
Thanks! |
My reasoning was that some implementations have their own notion of "off", so I thought it's better to defer to them on what they consider to be "off". Also, for consistency with the rest of the The Android logging, for example, has the level JUL allows subclassing and defining custom levels between Either way, if you'd prefer it as a common implementation with a simple |
Thanks! Since I am doing other changes in #320 I am going to merge this one before to avoid conflicts. Might change some things that were discussed in previous comments later. |
….0.2 (#106) [![Mend Renovate logo banner](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) | `4.0.0-beta-28` -> `4.0.2` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.oshai:kotlin-logging-jvm/4.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.oshai:kotlin-logging-jvm/4.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.oshai:kotlin-logging-jvm/4.0.0-beta-28/4.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.oshai:kotlin-logging-jvm/4.0.0-beta-28/4.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>oshai/kotlin-logging (io.github.oshai:kotlin-logging-jvm)</summary> ### [`v4.0.1`](https://togithub.com/oshai/kotlin-logging/releases/tag/4.0.1) [Compare Source](https://togithub.com/oshai/kotlin-logging/compare/4.0.0...4.0.1) #### What's Changed - Bump org.jetbrains.dokka from 1.8.10 to 1.8.20 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#324 - Bump multiplatform from 1.8.20 to 1.8.22 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#326 - Bump com.diffplug.spotless from 6.17.0 to 6.19.0 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#325 - change android to depend on slf4j2 by default by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#328 **Full Changelog**: oshai/kotlin-logging@4.0.0...4.0.1 ### [`v4.0.0`](https://togithub.com/oshai/kotlin-logging/releases/tag/4.0.0) [Compare Source](https://togithub.com/oshai/kotlin-logging/compare/4.0.0-beta-30...4.0.0) For TL;DR see https://github.com/oshai/kotlin-logging#version-4x-vs-previous-versions #### What's Changed - 4.x changes by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#269 - add missing klogger common methods by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#272 - removed some code duplication by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#273 - initial android support by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#271 - AGP 7.3.1 by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#274 - add javaMain module and remove duplication by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#275 - fix log level check for [#​276](https://togithub.com/oshai/kotlin-logging/issues/276) by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#277 - fix logger name in messages by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#280 - add withLoggingContextAsync by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#278 - add native simple test by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#281 - fixed some warnings by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#282 - add js delegate by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#283 - build(deps): bump log4j2 from 2.19.0 to 2.20.0 by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#284 - ci: add Gradle wrapper validation by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#285 - build(deps-dev): bump Junit from 5.9.1 to 5.9.2 by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#287 - build(deps-dev): bump mockito from 4.8.0 to 4.11.0 by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#286 - build: bump gradle wrapper to 7.6.1 by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#289 - Add dependabot configuration by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#291 - chore(dependabot): fix indentation by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#292 - Bump actions/checkout from 2 to 3 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#299 - Bump com.android.library from 7.3.1 to 7.4.2 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#294 - Bump org.jetbrains.dokka from 1.7.10 to 1.8.10 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#297 - Bump com.diffplug.spotless from 5.12.4 to 6.17.0 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#300 - Bump io.github.gradle-nexus.publish-plugin from 1.1.0 to 1.3.0 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#298 - Bump actions/cache from 2.1.7 to 3.3.1 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#296 - Bump actions/setup-java from 1 to 3 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#293 - Bump multiplatform from 1.8.10 to 1.8.20 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#302 - ci: use temurin by [@​yeikel](https://togithub.com/yeikel) in [oshai/kotlin-logging#301 - Allow turning off logging with `Level.OFF` by [@​YarnSphere](https://togithub.com/YarnSphere) in [oshai/kotlin-logging#313 - change package - add kotlinlogging by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#320 - Bump multiplatform from 1.8.20 to 1.8.22 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#321 - Bump org.jetbrains.dokka from 1.8.10 to 1.8.20 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#322 - Bump com.diffplug.spotless from 6.17.0 to 6.19.0 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#317 #### New Contributors - [@​dependabot](https://togithub.com/dependabot) made their first contribution in [oshai/kotlin-logging#299 **Full Changelog**: oshai/kotlin-logging@3.0.5...4.0.0 ### [`v4.0.0-beta-30`](https://togithub.com/oshai/kotlin-logging/releases/tag/4.0.0-beta-30) [Compare Source](https://togithub.com/oshai/kotlin-logging/compare/4.0.0-beta-29...4.0.0-beta-30) #### What's Changed - Bump multiplatform from 1.8.20 to 1.8.22 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#321 - Bump org.jetbrains.dokka from 1.8.10 to 1.8.20 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#322 - Bump com.diffplug.spotless from 6.17.0 to 6.19.0 by [@​dependabot](https://togithub.com/dependabot) in [oshai/kotlin-logging#317 **Full Changelog**: oshai/kotlin-logging@4.0.0-beta-29...4.0.0-beta-30 ### [`v4.0.0-beta-29`](https://togithub.com/oshai/kotlin-logging/releases/tag/4.0.0-beta-29) #### What's Changed - Allow turning off logging with `Level.OFF` by [@​YarnSphere](https://togithub.com/YarnSphere) in [oshai/kotlin-logging#313 - change package - add kotlinlogging by [@​oshai](https://togithub.com/oshai) in [oshai/kotlin-logging#320 **Full Changelog**: oshai/kotlin-logging@4.0.0-beta-27...4.0.0-beta-29 </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:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDcuMiIsInVwZGF0ZWRJblZlciI6IjM3LjQ2LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fixes #310.
I added the minimum amount of code to make this work, together with a test for JS and native.
It might make sense to add an
isOff
property toKLogger
(which could probably even be implemented in common code as!isErrorEnabled
), let me know what you think.