-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
157 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
api/src/main/java/com/tersesystems/echopraxia/spi/LoggerContext.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.tersesystems.echopraxia.spi; | ||
|
||
import com.tersesystems.echopraxia.api.Field; | ||
import java.util.List; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface LoggerContext { | ||
|
||
@NotNull | ||
List<Field> getLoggerFields(); | ||
} |
This file contains 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
32 changes: 32 additions & 0 deletions
32
api/src/testFixtures/java/com/tersesystems/echopraxia/fake/FakeLoggerContext.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.tersesystems.echopraxia.fake; | ||
|
||
import static com.tersesystems.echopraxia.spi.Utilities.joinFields; | ||
import static com.tersesystems.echopraxia.spi.Utilities.memoize; | ||
|
||
import com.tersesystems.echopraxia.api.Field; | ||
import com.tersesystems.echopraxia.spi.LoggerContext; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class FakeLoggerContext implements LoggerContext { | ||
private final Supplier<List<Field>> fieldsSupplier; | ||
|
||
public static FakeLoggerContext empty() { | ||
return new FakeLoggerContext(Collections::emptyList); | ||
} | ||
|
||
public FakeLoggerContext(Supplier<List<Field>> fieldsSupplier) { | ||
this.fieldsSupplier = memoize(fieldsSupplier); | ||
} | ||
|
||
@Override | ||
public @NotNull List<Field> getLoggerFields() { | ||
return fieldsSupplier.get(); | ||
} | ||
|
||
public LoggerContext withFields(Supplier<List<Field>> extraFields) { | ||
return new FakeLoggerContext(joinFields(fieldsSupplier, extraFields)); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
6 changes: 2 additions & 4 deletions
6
logback/src/main/java/com/tersesystems/echopraxia/logback/LogbackLoggerContext.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
package com.tersesystems.echopraxia.logback; | ||
|
||
import com.tersesystems.echopraxia.api.Field; | ||
import com.tersesystems.echopraxia.spi.LoggerContext; | ||
import java.util.List; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.slf4j.Marker; | ||
|
||
/** The logback context associated with the logger across multiple logging events. */ | ||
public interface LogbackLoggerContext { | ||
public interface LogbackLoggerContext extends LoggerContext { | ||
|
||
@NotNull | ||
List<Field> getLoggerFields(); | ||
|
||
List<Marker> getMarkers(); | ||
} |
This file contains 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
This file contains 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