Skip to content

Conversation

@alexander-yevsyukov
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov commented Sep 15, 2025

This PR simplifies the Logger API avoiding the intermediate JvmLogger and Middleman classes that were needed when the real logger had to be façaded under the abstract API which uses io.spine.logging.Level and LoggingDomain.

Implementation details

The Middleman class was renamed to Logger and pushed to the commonMain. The JvmLogger was eliminated.

The Middleman.forEnclosedClass() was removed in favor of already present LoggingFactory.forEnclosedClass() factory function.

Shortcut properties for at<Level> methods of a Logger

The WithLogging interface got atSevere, atInfo, atDebug and the like properties that serve as a shortcut for logger.atSevere() and the like methods. This is for brevity of the logging calls:

atInfo.log { "Warming up..." }

Other notable changes

  • Extension functions for the Level classes were moved under LoggerExts.kt file.
  • LoggingFactory was reworked to handle ClassValue<Logger> via a nested object instead of using inheritance.

Breaking API change

The Logger class now does not have a generic parameter. So Logger<*> or Logger<?> at the usage sites must be replaced with just Logger.

@alexander-yevsyukov alexander-yevsyukov self-assigned this Sep 15, 2025
@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 3.17460% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 14.82%. Comparing base (79f4563) to head (5b098b9).
⚠️ Report is 20 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexander-yevsyukov alexander-yevsyukov changed the title Simplify logger api Simplify Logger api Sep 15, 2025
@alexander-yevsyukov alexander-yevsyukov changed the title Simplify Logger api Simplify Logger API Sep 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 JvmLogger and Middleman classes in favor of a unified Logger implementation
  • Moved the consolidated Logger class to commonMain for broader platform support
  • Refactored LoggingFactory to use a nested object pattern for ClassValue<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

@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review September 15, 2025 13:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

@alexander-yevsyukov alexander-yevsyukov changed the title Simplify Logger API Simplify Logger API, add shortcut properties for WithLogging Sep 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

@alexander-yevsyukov alexander-yevsyukov merged commit 7655043 into master Sep 15, 2025
7 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the simplify-logger-api branch September 15, 2025 15:51
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