Package nl.vpro.logging.simple
Class SimpleLoggerOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- nl.vpro.logging.AbstractLoggerOutputStream
-
- nl.vpro.logging.simple.SimpleLoggerOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public abstract class SimpleLoggerOutputStream extends AbstractLoggerOutputStream
If you want to convert a
SimpleLogger
to aOutputStream
this can be used. Every line appearing on the output stream will be logged using the suppliedSimpleLogger
.One use case is for example to convert lines output from some external command to events like so:
CommandExecutorImpl oc = CommandExecutorImpl.builder() .executablesPaths("/usr/local/bin/oc") .build(); oc.submit(SimpleLoggerOutputStream.info(EventSimpleLogger.of( event -> { if (event.getMessage().toString().contains("Forwarding from [::1]:" + jmxPort)) { synchronized (container) { container.ready = true; container.notifyAll(); } } })), "-n", "poms-stack-" + env, "port-forward", pod, jmxPort );
-
-
Field Summary
-
Fields inherited from class nl.vpro.logging.AbstractLoggerOutputStream
charset, count, max
-
-
Constructor Summary
Constructors Constructor Description SimpleLoggerOutputStream(boolean skipEmptyLines)
SimpleLoggerOutputStream(boolean skipEmptyLines, Integer max)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SimpleLoggerOutputStream
error(SimpleLogger log)
static SimpleLoggerOutputStream
error(SimpleLogger log, boolean skipEmptyLines)
static SimpleLoggerOutputStream
info(SimpleLogger log)
static SimpleLoggerOutputStream
info(SimpleLogger log, boolean skipEmptyLines)
-
Methods inherited from class nl.vpro.logging.AbstractLoggerOutputStream
close, flush, getCharset, getCount, getMax, log, setCharset, setMax, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
-
-
-
Constructor Detail
-
SimpleLoggerOutputStream
public SimpleLoggerOutputStream(boolean skipEmptyLines, Integer max)
-
SimpleLoggerOutputStream
public SimpleLoggerOutputStream(boolean skipEmptyLines)
-
-
Method Detail
-
info
public static SimpleLoggerOutputStream info(SimpleLogger log)
-
info
public static SimpleLoggerOutputStream info(SimpleLogger log, boolean skipEmptyLines)
-
error
public static SimpleLoggerOutputStream error(SimpleLogger log)
-
error
public static SimpleLoggerOutputStream error(SimpleLogger log, boolean skipEmptyLines)
-
-