Skip to content

Commit

Permalink
+ minor maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
q3769 committed Apr 16, 2024
1 parent 0b8cc54 commit a312b8c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@
<annotationProcessor>com.dslplatform.json.processor.CompiledJsonAnnotationProcessor
</annotationProcessor>
</annotationProcessors>
<compilerArguments>
<compilerArgs>
<Adsljson.loglevel>DEBUG</Adsljson.loglevel>
<!--Adsljson.annotation>EXPLICIT</Adsljson.annotation-->
<Adsljson.unknown>ALLOW</Adsljson.unknown>
<!--Adsljson.configuration>com.dslplatform.maven.DslJsonConfiguration</Adsljson.configuration-->
</compilerArguments>
</compilerArgs>
</configuration>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class EventingNativeLoggerService implements NativeLoggerService {
private final LoggerOutputLevelThreshold loggerOutputLevelThreshold;
private final Map<NativeLogger, Boolean> loggerEnabled = new ConcurrentHashMap<>();

/** @param logServiceConfiguration parsed configuration for the logger service */
public EventingNativeLoggerService(@NonNull LogServiceConfiguration logServiceConfiguration) {
if (logServiceConfiguration.isAbsent() || logServiceConfiguration.isTrue("noop")) {
noop = true;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/elf4j/engine/service/LogEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public static class StackFrameValue {

@Nullable String fileName;

/**
* @param stackTraceElement call stack element
* @return log render-able value representing the call stack element
*/
public static StackFrameValue from(@NonNull StackTraceElement stackTraceElement) {
return LogEvent.StackFrameValue.builder()
.fileName(stackTraceElement.getFileName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void shutdown() {
return new Thread(this::shutdown);
}

/** @param refreshable to be deregistered */
public void deregister(Refreshable refreshable) {
lockAndRun(() -> refreshables.remove(refreshable));
IeLogger.INFO.log("De-registered Refreshable {}", refreshable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import lombok.NonNull;
import org.slf4j.MDC;

/** */
public class ContextElement implements PatternElement {
final String key;

/** @param key whose value will be printed out from the thread context */
public ContextElement(String key) {
this.key = key;
}
Expand All @@ -17,6 +19,10 @@ public boolean includeCallerDetail() {
return false;
}

/**
* @param patternSegment the pattern text to config the context logging
* @return the element that can render context log
*/
public static @NonNull ContextElement from(String patternSegment) {
return new ContextElement(PatternElements.getPatternElementDisplayOption(patternSegment)
.orElseThrow(() -> new NoSuchElementException("No key configured in 'context' pattern element")));
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/slf4j/MdcAdapterInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.spi.MDCAdapter;

/** Initializes the SLF4J's MDC implementation */
public class MdcAdapterInitializer {
private MdcAdapterInitializer() {}

/** */
public static void initialize() {
MDCAdapter byOtherSlf4jProvider = MDC.mdcAdapter;
if (byOtherSlf4jProvider == null || byOtherSlf4jProvider instanceof NOPMDCAdapter) {
Expand Down

0 comments on commit a312b8c

Please sign in to comment.