Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@
import io.spine.logging.Level;
import io.spine.logging.backend.LoggerBackend;

import java.util.logging.Filter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import static io.spine.logging.JvmLoggerKt.toJavaLogging;
import static io.spine.logging.Levels.toJavaLogging;

/**
* An abstract implementation of {@code java.util.logging} (JUL) based backend.
Expand Down Expand Up @@ -130,7 +128,7 @@ public final void log(LogRecord record, boolean wasForced) {
//
// In all cases we still call the filter (if one exists) even though we ignore the result.
// Use a local variable to avoid race conditions where the filter can be unset at any time.
Filter filter = logger.getFilter();
var filter = logger.getFilter();
if (filter != null) {
filter.isLoggable(record);
}
Expand Down Expand Up @@ -169,7 +167,7 @@ private static void publish(Logger logger, LogRecord record) {
// nothing much we can do about this (and there could be synchronization issues even if we
// could access things directly because handlers can be changed at any time). Most of the
// time this returns the singleton empty array however, so it's not as bad as all that.
for (Handler handler : logger.getHandlers()) {
for (var handler : logger.getHandlers()) {
handler.publish(record);
}
if (logger.getUseParentHandlers()) {
Expand All @@ -185,7 +183,7 @@ private static void publish(Logger logger, LogRecord record) {
// subclasses of Logger to be used.
void forceLoggingViaChildLogger(LogRecord record) {
// Assume that nobody else will configure or manipulate loggers with this "secret" name.
Logger forcingLogger = getForcingLogger(logger);
var forcingLogger = getForcingLogger(logger);

// This logger can be garbage collected at any time, so we must always reset any configuration.
// This code is subject to a bunch of unlikely race conditions if the logger is manipulated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.ResourceBundle;
import java.util.logging.LogRecord;

import static io.spine.logging.JvmLoggerKt.toJavaLogging;
import static io.spine.logging.Levels.toJavaLogging;
import static java.time.Instant.ofEpochMilli;
import static java.util.Objects.requireNonNullElse;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static io.spine.logging.JvmLoggerKt.toLevel;
import static io.spine.logging.Levels.toLevel;
import static io.spine.logging.backend.MetadataProcessor.forScopeAndLogSite;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
Expand Down
64 changes: 32 additions & 32 deletions dependencies.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


# Dependencies of `io.spine:spine-logging-context-tests:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-context-tests:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : org.jetbrains. **Name** : annotations. **Version** : 26.0.2.
Expand Down Expand Up @@ -413,14 +413,14 @@

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-fixtures:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-fixtures:2.0.0-SNAPSHOT.400`

## Runtime
## Compile, tests, and tooling
Expand Down Expand Up @@ -1148,14 +1148,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:54 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-grpc-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-grpc-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -1982,14 +1982,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jul-backend:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jul-backend:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -2800,14 +2800,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jvm-default-platform:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jvm-default-platform:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -3662,14 +3662,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jvm-jul-backend-grpc-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jvm-jul-backend-grpc-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -4520,14 +4520,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jvm-jul-backend-std-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jvm-jul-backend-std-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -5370,14 +5370,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jvm-log4j2-backend-std-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jvm-log4j2-backend-std-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -6220,14 +6220,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jvm-slf4j-jdk14-backend-std-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jvm-slf4j-jdk14-backend-std-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -7078,14 +7078,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-jvm-slf4j-reload4j-backend-std-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-jvm-slf4j-reload4j-backend-std-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -7940,14 +7940,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-log4j2-backend:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-log4j2-backend:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -8782,14 +8782,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging:2.0.0-SNAPSHOT.400`

## Runtime
## Compile, tests, and tooling
Expand Down Expand Up @@ -9521,14 +9521,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-logging-testlib:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine.tools:spine-logging-testlib:2.0.0-SNAPSHOT.400`

## Runtime
## Compile, tests, and tooling
Expand Down Expand Up @@ -10256,14 +10256,14 @@ This report was generated on **Mon Sep 15 12:08:01 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:54 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-probe-backend:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-probe-backend:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.auto.service. **Name** : auto-service-annotations. **Version** : 1.1.1.
Expand Down Expand Up @@ -11122,14 +11122,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-smoke-test:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-smoke-test:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3.
Expand Down Expand Up @@ -12008,14 +12008,14 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-logging-std-context:2.0.0-SNAPSHOT.390`
# Dependencies of `io.spine:spine-logging-std-context:2.0.0-SNAPSHOT.400`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -12826,6 +12826,6 @@ This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Mon Sep 15 12:08:00 WEST 2025** using
This report was generated on **Mon Sep 15 16:45:53 WEST 2025** using
[Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under
[Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
15 changes: 15 additions & 0 deletions logging/src/commonMain/kotlin/io/spine/logging/AbstractLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public abstract class AbstractLogger<API : LoggingApi<API>> protected constructo
*/
public fun atSevere(): API = at(Level.SEVERE)

/**
* A convenience method for at([Level.ERROR]).
*/
public fun atError(): API = at(Level.ERROR)

/**
* A convenience method for at([Level.WARNING]).
*/
Expand All @@ -118,11 +123,21 @@ public abstract class AbstractLogger<API : LoggingApi<API>> protected constructo
*/
public fun atFine(): API = at(Level.FINE)

/**
* A convenience method for at([Level.DEBUG]).
*/
public fun atDebug(): API = at(Level.DEBUG)

/**
* A convenience method for at([Level.FINER]).
*/
public fun atFiner(): API = at(Level.FINER)

/**
* A convenience method for at([Level.TRACE]).
*/
public fun atTrace(): API = at(Level.TRACE)

/**
* A convenience method for at([Level.FINEST]).
*/
Expand Down
10 changes: 8 additions & 2 deletions logging/src/commonMain/kotlin/io/spine/logging/LogContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ protected constructor(
*/
private var literalArg: String? = null

private var loggingDomain: LoggingDomain? = null

/**
* Creates a logging context with the specified level, and with a timestamp obtained from the
* configured logging [Platform].
Expand Down Expand Up @@ -411,7 +413,8 @@ protected constructor(
* This method takes a single string parameter as it's always called with one string argument.
*/
private fun logImpl(arg: String?) {
this.literalArg = arg
val prefix = loggingDomain?.messagePrefix ?: ""
this.literalArg = prefix + arg

// Right at the end of processing add any tags injected by the platform.
// Any tags supplied at the log site are merged with the injected tags
Expand Down Expand Up @@ -465,7 +468,10 @@ protected constructor(
return wasForced() || getLogger().doIsLoggable(level)
}

public override fun withLoggingDomain(domain: LoggingDomain): API = api()
public override fun withLoggingDomain(domain: LoggingDomain): API {
this.loggingDomain = domain
return api()
}

public final override fun <T : Any> with(key: MetadataKey<T>, value: T?): API {
if (value != null) {
Expand Down
Loading
Loading