Skip to content

Commit

Permalink
+ conseq4j version bump
Browse files Browse the repository at this point in the history
+ dsl-json version bump
  • Loading branch information
q3769 committed Sep 24, 2023
1 parent 57d0747 commit 27801dc
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 109 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
</dependency>
<dependency>
<groupId>com.dslplatform</groupId>
<artifactId>dsl-json-java8</artifactId>
<version>1.10.0</version>
<artifactId>dsl-json</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/elf4j/engine/service/EventingLogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ public boolean includeCallerDetail() {
return this.logServiceConfiguration.getLogServiceWriter().includeCallerDetail();
}

@Override
public boolean includeCallerThread() {
return this.logServiceConfiguration.getLogServiceWriter().includeCallerThread();
}

@Override
public boolean isEnabled(NativeLogger nativeLogger) {
return logServiceConfiguration.isEnabled(nativeLogger);
Expand Down Expand Up @@ -85,4 +80,3 @@ public void log(@NonNull NativeLogger nativeLogger,
this.logServiceConfiguration.getLogEventProcessor().process(logEventBuilder.build());
}
}

7 changes: 1 addition & 6 deletions src/main/java/elf4j/engine/service/pattern/ClassPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class ClassPattern implements LogPattern {
class ClassPattern implements LogPattern {
private static final DisplayOption DEFAULT_DISPLAY_OPTION = DisplayOption.SIMPLE;
@NonNull DisplayOption classDisplayOption;

Expand Down Expand Up @@ -64,11 +64,6 @@ public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, StringBuilder target) {
String fullName = logEvent.getCallerClassName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class FileNamePattern implements LogPattern {
class FileNamePattern implements LogPattern {
/**
* @param patternSegment
* text segment to convert
Expand All @@ -54,11 +54,6 @@ public boolean includeCallerDetail() {
return true;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, @NonNull StringBuilder target) {
target.append(logEvent.getCallerDetail().getFileName());
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/elf4j/engine/service/pattern/JsonPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*/
@Value
@Builder
public class JsonPattern implements LogPattern {
class JsonPattern implements LogPattern {
private static final String UTF_8 = StandardCharsets.UTF_8.toString();
private static final int JSON_BYTES_INIT_SIZE = 1024;
private static final String CALLER_DETAIL = "caller-detail";
Expand Down Expand Up @@ -97,11 +97,6 @@ public boolean includeCallerDetail() {
return this.includeCallerDetail;
}

@Override
public boolean includeCallerThread() {
return this.includeCallerThread;
}

@Override
public void render(LogEvent logEvent, @NonNull StringBuilder target) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(JSON_BYTES_INIT_SIZE);
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/elf4j/engine/service/pattern/LevelPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class LevelPattern implements LogPattern {
class LevelPattern implements LogPattern {
private static final int UNSPECIFIED = -1;
int displayLength;

Expand Down Expand Up @@ -63,11 +63,6 @@ public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, StringBuilder target) {
String level = logEvent.getNativeLogger().getLevel().name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class LineNumberPattern implements LogPattern {
class LineNumberPattern implements LogPattern {
/**
* @param patternSegment
* text segment to convert
Expand All @@ -54,11 +54,6 @@ public boolean includeCallerDetail() {
return true;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, @NonNull StringBuilder target) {
target.append(logEvent.getCallerDetail().getLineNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
*/
@Value
public class MessageAndExceptionPattern implements LogPattern {
class MessageAndExceptionPattern implements LogPattern {
/**
* @param patternSegment
* text segment to convert
Expand All @@ -55,11 +55,6 @@ public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, @NonNull StringBuilder target) {
target.append(logEvent.getResolvedMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class MethodPattern implements LogPattern {
class MethodPattern implements LogPattern {
/**
* @param patternSegment
* text segment to convert
Expand All @@ -54,11 +54,6 @@ public boolean includeCallerDetail() {
return true;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, @NonNull StringBuilder target) {
target.append(logEvent.getCallerDetail().getMethodName());
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/elf4j/engine/service/pattern/PatternGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ public boolean includeCallerDetail() {
return patterns.stream().anyMatch(LogPattern::includeCallerDetail);
}

@Override
public boolean includeCallerThread() {
return patterns.stream().anyMatch(LogPattern::includeCallerThread);
}

@Override
public void render(LogEvent logEvent, StringBuilder target) {
for (LogPattern pattern : patterns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class SystemEnvironmentPattern implements LogPattern {
class SystemEnvironmentPattern implements LogPattern {
String key;
String value;

Expand Down Expand Up @@ -67,9 +67,4 @@ public void render(LogEvent logEvent, StringBuilder target) {
public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class SystemPropertyPattern implements LogPattern {
class SystemPropertyPattern implements LogPattern {
String key;

private SystemPropertyPattern(String key) {
Expand Down Expand Up @@ -65,9 +65,4 @@ public void render(LogEvent logEvent, StringBuilder target) {
public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
*/
@Value
public class ThreadPattern implements LogPattern {
class ThreadPattern implements LogPattern {
@NonNull ThreadPattern.DisplayOption threadDisplayOption;

/**
Expand All @@ -59,11 +59,6 @@ public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return true;
}

@Override
public void render(@NonNull LogEvent logEvent, @NonNull StringBuilder target) {
LogEvent.ThreadValue callerThread = Objects.requireNonNull(logEvent.getCallerThread());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
*/
@Value
public class TimestampPattern implements LogPattern {
class TimestampPattern implements LogPattern {
private static final String DEFAULT_DATETIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
private static final ZoneId DISPLAY_TIME_ZONE = ZoneId.systemDefault();
DateTimeFormatter dateTimeFormatter;
Expand Down Expand Up @@ -67,11 +67,6 @@ public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(@NonNull LogEvent logEvent, @NonNull StringBuilder target) {
dateTimeFormatter.formatTo(logEvent.getTimestamp(), target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
*/
@Value
public class VerbatimPattern implements LogPattern {
class VerbatimPattern implements LogPattern {
@NonNull String text;

/**
Expand All @@ -59,11 +59,6 @@ public boolean includeCallerDetail() {
return false;
}

@Override
public boolean includeCallerThread() {
return false;
}

@Override
public void render(LogEvent logEvent, @NonNull StringBuilder target) {
target.append(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public class ConseqWriterGroup implements LogWriter, Stoppable {
private final ConseqExecutor conseqExecutor;
private Level minimumLevel;
@ToString.Exclude private Boolean includeCallerDetail;
@ToString.Exclude private Boolean includeCallerThread;

private ConseqWriterGroup(List<LogWriter> writers, ConseqExecutor conseqExecutor) {
this.writers = writers;
Expand Down Expand Up @@ -132,14 +131,6 @@ public boolean includeCallerDetail() {
return includeCallerDetail;
}

@Override
public boolean includeCallerThread() {
if (includeCallerThread == null) {
includeCallerThread = writers.stream().anyMatch(LogWriter::includeCallerThread);
}
return includeCallerThread;
}

@Override
public void stop() {
IeLogger.INFO.log("Stopping {}", this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ public interface PerformanceSensitive {
* @return true if log should include caller detail such as method, line number...
*/
boolean includeCallerDetail();

/**
* @return true if log should include call thread information such thread name and id
*/
boolean includeCallerThread();
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ public boolean includeCallerDetail() {
return logPattern.includeCallerDetail();
}

@Override
public boolean includeCallerThread() {
return logPattern.includeCallerThread();
}

enum OutStreamType {
STDOUT,
STDERR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,27 @@ class from {
void noPatternOptionDefaults() {
JsonPattern jsonPattern = JsonPattern.from("json");

assertFalse(jsonPattern.includeCallerThread());
assertFalse(jsonPattern.includeCallerDetail());
}

@Test
void includeCallerOption() {
JsonPattern jsonPattern = JsonPattern.from("json:caller-detail");

assertFalse(jsonPattern.includeCallerThread());
assertTrue(jsonPattern.includeCallerDetail());
}

@Test
void includeThreadOption() {
JsonPattern jsonPattern = JsonPattern.from("json:caller-thread");

assertTrue(jsonPattern.includeCallerThread());
assertFalse(jsonPattern.includeCallerDetail());
}

@Test
void includeCallerAndThreadOptions() {
JsonPattern jsonPattern = JsonPattern.from("json:caller-thread,caller-detail");

assertTrue(jsonPattern.includeCallerThread());
assertTrue(jsonPattern.includeCallerDetail());
}
}
Expand All @@ -111,4 +107,4 @@ void resolveMessage() {
assertTrue(rendered.contains(mockLogEvent.getResolvedMessage()));
}
}
}
}

0 comments on commit 27801dc

Please sign in to comment.