Class BuildLogFileWriter
- java.lang.Object
-
- com.atlassian.bamboo.build.logger.BuildLogFileWriter
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@NotThreadSafe public class BuildLogFileWriter extends Object implements Closeable, Flushable
Class to encapsulate streaming of build logs. The writer is opened on creation of the BuildLogFileWriter and a call to close() must be made when finished writing. This class is deliberately made not thread safe.
-
-
Constructor Summary
Constructors Constructor Description BuildLogFileWriter(File logFile, @NotNull ExpiryTicker expiryTicker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the writer to the log file.voidflush()voidwriteLog(@NotNull LogEntry logEntry)Writes one line of logs to the log filevoidwriteVerbatim(@NotNull String text)Writes a text to a log file without any changes.
-
-
-
Constructor Detail
-
BuildLogFileWriter
public BuildLogFileWriter(File logFile, @NotNull @NotNull ExpiryTicker expiryTicker)
-
-
Method Detail
-
writeLog
public void writeLog(@NotNull @NotNull LogEntry logEntry) throws IOExceptionWrites one line of logs to the log file- Parameters:
logEntry- to be written to file- Throws:
IOException- if errors accessing the file
-
writeVerbatim
public void writeVerbatim(@NotNull @NotNull String text) throws IOExceptionWrites a text to a log file without any changes.- Throws:
IOException
-
close
public void close() throws IOExceptionCloses the writer to the log file. Must be called when writing complete- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if problems closing the file
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
-