Skip to content

Commit

Permalink
add loglevel field
Browse files Browse the repository at this point in the history
  • Loading branch information
burdoto committed Jan 21, 2024
1 parent b17ca6e commit 2ec18a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/comroid/api/func/ext/Wrap.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.comroid.api.func.ext;

import lombok.Setter;
import lombok.Value;
import lombok.experimental.Delegate;
import lombok.experimental.NonFinal;
import org.comroid.annotations.Category;
import org.comroid.annotations.Ignore;
import org.comroid.api.attr.MutableState;
Expand Down Expand Up @@ -348,6 +350,7 @@ default <O> Wrap<O> flatMap(final @NotNull Function<? super T, Supplier<? extend
@Value
class Future<T> implements Wrap<T> {
@Delegate CompletableFuture<T> future;
@NonFinal @Setter @NotNull Level logLevel = Level.FINE;

public Future() {
this(new CompletableFuture<>());
Expand All @@ -362,7 +365,7 @@ public T get() {
try {
return future.get(0, TimeUnit.SECONDS);
} catch (ExecutionException | InterruptedException | TimeoutException e) {
Log.at(Level.WARNING, "Failed to immediately get resource", e);
Log.at(logLevel, "Failed to immediately get resource", e);
return null;
}
}
Expand Down

0 comments on commit 2ec18a2

Please sign in to comment.