Simplify Logger API, add shortcut properties for WithLogging#132
Merged
alexander-yevsyukov merged 19 commits intomasterfrom Sep 15, 2025
Merged
Simplify Logger API, add shortcut properties for WithLogging#132alexander-yevsyukov merged 19 commits intomasterfrom
Logger API, add shortcut properties for WithLogging#132alexander-yevsyukov merged 19 commits intomasterfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #132 +/- ##
============================================
+ Coverage 14.59% 14.82% +0.22%
Complexity 147 147
============================================
Files 103 102 -1
Lines 2733 2691 -42
Branches 380 374 -6
============================================
Hits 399 399
+ Misses 2304 2262 -42
Partials 30 30 🚀 New features to boost your workflow:
|
Also: * Add more `AbstractLogger.atXxx()` functions for missing `Level` values.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the Logger API by eliminating intermediate classes and streamlining the logging factory implementation. The main changes consolidate logging functionality into a single Logger class instead of the previous multi-layered approach with JvmLogger and Middleman.
- Removed
JvmLoggerandMiddlemanclasses in favor of a unifiedLoggerimplementation - Moved the consolidated
Loggerclass tocommonMainfor broader platform support - Refactored
LoggingFactoryto use a nested object pattern forClassValue<Logger>handling
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Version bump to 2.0.0-SNAPSHOT.400 |
| pom.xml | Version update in Maven POM |
| dependencies.md | Updated dependency report with new version |
| logging/src/commonMain/kotlin/io/spine/logging/Logger.kt | New unified Logger implementation moved from JVM-specific code |
| logging/src/commonMain/kotlin/io/spine/logging/LoggingFactory.kt | Updated factory to return non-generic Logger instances |
| logging/src/commonMain/kotlin/io/spine/logging/WithLogging.kt | Updated interface to use non-generic Logger type |
| logging/src/jvmMain/kotlin/io/spine/logging/LoggingFactory.kt | Refactored with nested LoggerClassValue object |
| logging/src/jvmMain/kotlin/io/spine/logging/LevelExts.kt | New file containing Level extension functions |
| Multiple test files | Updated type references from JvmLogger to Logger |
| Backend files | Updated import statements to use new Levels class |
backends/jul-backend/src/main/java/io/spine/logging/backend/jul/AbstractJulBackend.java
Outdated
Show resolved
Hide resolved
backends/jul-backend/src/main/java/io/spine/logging/backend/jul/AbstractJulBackend.java
Show resolved
Hide resolved
backends/jul-backend/src/main/java/io/spine/logging/backend/jul/AbstractJulBackend.java
Outdated
Show resolved
Hide resolved
Logger APILogger API, add shortcut properties for WithLogging
armiol
approved these changes
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR simplifies the
LoggerAPI avoiding the intermediateJvmLoggerandMiddlemanclasses that were needed when the real logger had to be façaded under the abstract API which usesio.spine.logging.LevelandLoggingDomain.Implementation details
The
Middlemanclass was renamed toLoggerand pushed to thecommonMain. TheJvmLoggerwas eliminated.The
Middleman.forEnclosedClass()was removed in favor of already presentLoggingFactory.forEnclosedClass()factory function.Shortcut properties for
at<Level>methods of aLoggerThe
WithLogginginterface gotatSevere,atInfo,atDebugand the like properties that serve as a shortcut forlogger.atSevere()and the like methods. This is for brevity of the logging calls:atInfo.log { "Warming up..." }Other notable changes
Levelclasses were moved underLoggerExts.ktfile.LoggingFactorywas reworked to handleClassValue<Logger>via a nested object instead of using inheritance.Breaking API change
The
Loggerclass now does not have a generic parameter. SoLogger<*>orLogger<?>at the usage sites must be replaced with justLogger.