-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- slf4j replaces jul - code model messages via slf4j logger - system javac compiler messages via slf4j logger - jmh upgraded to version 1.21 - minor naming and style fixes in test classes
- Loading branch information
Showing
7 changed files
with
138 additions
and
54 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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/com/rtbhouse/utils/avro/LoggingOutputStream.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,37 @@ | ||
package com.rtbhouse.utils.avro; | ||
|
||
import org.slf4j.Logger; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.OutputStream; | ||
import java.util.function.Consumer; | ||
|
||
final class LoggingOutputStream extends OutputStream { | ||
|
||
private final ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); | ||
private final Consumer<String> loggingMethod; | ||
|
||
private LoggingOutputStream(Consumer<String> loggingMethod) { | ||
this.loggingMethod = loggingMethod; | ||
} | ||
|
||
@Override | ||
public void write(int b) { | ||
if (b == '\n') { | ||
String line = baos.toString(); | ||
baos.reset(); | ||
loggingMethod.accept(line); | ||
} else { | ||
baos.write(b); | ||
} | ||
} | ||
|
||
static LoggingOutputStream infoLoggingStream(Logger logger) { | ||
return new LoggingOutputStream(logger::info); | ||
} | ||
|
||
static LoggingOutputStream errorLoggingStream(Logger logger) { | ||
return new LoggingOutputStream(logger::error); | ||
} | ||
|
||
} |
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