Class ConsoleAccumulator
java.lang.Object
com.scivicslab.turingworkflow.plugins.logoutput.ConsoleAccumulator
- All Implemented Interfaces:
com.scivicslab.pojoactor.core.accumulator.Accumulator
public class ConsoleAccumulator
extends Object
implements com.scivicslab.pojoactor.core.accumulator.Accumulator
An
Accumulator implementation that writes output to the console
via PrintStream instances (typically System.out and System.err).
Each entry is formatted with a [source] prefix on every line.
Entries with type "stderr" are routed to the error stream; all other
types (including "stdout" and "cowsay") are routed to the
standard output stream.
When quiet mode is enabled, entries are counted but not printed.
- Since:
- 1.0
- Author:
- devteam@scivicslab.com
-
Constructor Summary
ConstructorsConstructorDescriptionConsoleAccumulator(PrintStream stdout, PrintStream stderr) Constructs aConsoleAccumulatorwith the specified output streams. -
Method Summary
-
Constructor Details
-
ConsoleAccumulator
public ConsoleAccumulator() -
ConsoleAccumulator
Constructs aConsoleAccumulatorwith the specified output streams.- Parameters:
stdout- the stream for standard output entriesstderr- the stream for error output entries
-
-
Method Details
-
setQuiet
public void setQuiet(boolean quiet) Enables or disables quiet mode. In quiet mode, entries are counted but not printed to the console.- Parameters:
quiet-trueto suppress output;falseto print normally
-
isQuiet
public boolean isQuiet()Returns whether quiet mode is currently enabled.- Returns:
trueif quiet mode is enabled
-
add
Routes the entry to
stderrif the type is"stderr", otherwise tostdout. If quiet mode is enabled or data isnull/empty, the entry is silently counted.- Specified by:
addin interfacecom.scivicslab.pojoactor.core.accumulator.Accumulator
-
getSummary
- Specified by:
getSummaryin interfacecom.scivicslab.pojoactor.core.accumulator.Accumulator
-
getCount
public int getCount()- Specified by:
getCountin interfacecom.scivicslab.pojoactor.core.accumulator.Accumulator
-
clear
public void clear()- Specified by:
clearin interfacecom.scivicslab.pojoactor.core.accumulator.Accumulator
-