Skip to content

Commit

Permalink
+ fixed default writer's out stream type
Browse files Browse the repository at this point in the history
+ conseq4j version bump
  • Loading branch information
q3769 committed Sep 30, 2023
1 parent dc8a734 commit 9295a7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<groupId>io.github.elf4j</groupId>
<artifactId>elf4j-engine</artifactId>
<version>12.0.4</version>
<version>12.0.5</version>
<packaging>jar</packaging>
<name>elf4j-engine</name>
<description>A stand-alone Java log engine implementing the ELF4J (Easy Logging Facade for Java) API</description>
Expand Down Expand Up @@ -77,7 +77,7 @@
<dependency>
<groupId>io.github.q3769</groupId>
<artifactId>conseq4j</artifactId>
<version>20230922.20230924.0</version>
<version>20230922.20230924.20230924</version>
</dependency>
<dependency>
<groupId>com.dslplatform</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,18 @@ private static StandardStreamsWriter getDefaultWriter(@NonNull LogServiceConfigu
.trim()
.toUpperCase()))
.logPattern(PatternGroup.from(properties.getProperty("pattern", DEFAULT_PATTERN)))
.outStreamType(DEFAULT_OUT_STREAM_TYPE)
.outStreamType(getGlobalOutStreamType(properties))
.standardOutput(logServiceConfiguration.getStandardOutput())
.build();
}

private static String getWriterConfigurationValueOrDefault(String name,
@NonNull
private static OutStreamType getGlobalOutStreamType(Properties properties) {
return OutStreamType.valueOf(properties.getProperty("stream", DEFAULT_OUT_STREAM_TYPE.name())
.toUpperCase());
}

private static String getWriterConfigurationValueOrGlobalDefault(String name,
Map<String, String> writerConfiguration,
Properties properties,
String defaultValue) {
Expand All @@ -120,13 +126,15 @@ public List<LogWriter> getLogWriters(LogServiceConfiguration logServiceConfigura
}
return writerConfigurations.stream()
.map(writerConfiguration -> StandardStreamsWriter.builder()
.outStreamType(OutStreamType.valueOf(properties.getProperty("stream",
DEFAULT_OUT_STREAM_TYPE.name()).toUpperCase()))
.minimumLevel(Level.valueOf(getWriterConfigurationValueOrDefault("level",
.outStreamType(OutStreamType.valueOf(getWriterConfigurationValueOrGlobalDefault("stream",
writerConfiguration,
properties,
DEFAULT_OUT_STREAM_TYPE.name()).trim().toUpperCase()))
.minimumLevel(Level.valueOf(getWriterConfigurationValueOrGlobalDefault("level",
writerConfiguration,
properties,
DEFAULT_MINIMUM_LEVEL).trim().toUpperCase()))
.logPattern(PatternGroup.from(getWriterConfigurationValueOrDefault("pattern",
.logPattern(PatternGroup.from(getWriterConfigurationValueOrGlobalDefault("pattern",
writerConfiguration,
properties,
DEFAULT_PATTERN)))
Expand Down

0 comments on commit 9295a7b

Please sign in to comment.