Package org.microproxy.extras
Class AccessLogWriter
java.lang.Object
org.microproxy.extras.AccessLogWriter
- All Implemented Interfaces:
AutoCloseable,Consumer<String>
Where an
ActivityLogger writes its lines: a file it appends to, or standard output. Each
line is written whole and flushed, under a lock, so lines from concurrent exchanges never mix
and nothing is lost when the process stops without closing it.-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()static AccessLogWriterOpenstarget:-for standard output, else a file path.static AccessLogWriterAppends lines tofile, creating it if needed.static AccessLogWriterto(PrintStream stream) Writes lines tostream, such asSystem.out, which closing the writer leaves open.toString()
-
Method Details
-
open
Appends lines tofile, creating it if needed.- Parameters:
file- the log file- Returns:
- the writer
- Throws:
UncheckedIOException- if the file cannot be opened
-
to
Writes lines tostream, such asSystem.out, which closing the writer leaves open.- Parameters:
stream- the stream- Returns:
- the writer
-
of
Openstarget:-for standard output, else a file path.- Parameters:
target--or a path- Returns:
- the writer
-
accept
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
toString
-