com.atlassian.bamboo.build.logger
Class SimpleBuildLogger

java.lang.Object
  extended by com.atlassian.bamboo.build.logger.SimpleBuildLogger
All Implemented Interfaces:
BuildLogger

public class SimpleBuildLogger
extends java.lang.Object
implements BuildLogger

The simple logger simply stores all the logs internally as a a list... Useful for testing


Constructor Summary
SimpleBuildLogger()
           
 
Method Summary
 java.lang.String addBuildLogEntry(LogEntry logEntry)
          Add a new build log entry.
 java.lang.String addBuildLogEntry(java.lang.String logString)
          Create a new build log entry from text to append to logs
 java.lang.String addBuildLogHeader(java.lang.String logString, boolean showBothBanner)
           
 java.lang.String addErrorLogEntry(LogEntry logEntry)
          Add a new build error log entry.
 java.lang.String addErrorLogEntry(java.lang.String logString)
          Add a new build error log entry from text.
 void clearBuildLog()
          Reset the build log, ready for the next build
 java.util.List<LogEntry> getBuildLog()
          Provide the latest build details (last 100 lines of logs).
 java.util.List<LogEntry> getErrorLog()
          Provide the latest error logs.
 java.util.List<java.lang.String> getStringErrorLogs()
           
 long getTimeOfLastLog()
          last time a log entry was added.
 void startStreamingBuildLogs(int buildNum, java.lang.String planKey)
          Begin streaming any logs to build logs file
 void stopStreamingBuildLogs()
          Stop streaming any logs to the build logs file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBuildLogger

public SimpleBuildLogger()
Method Detail

getErrorLog

public java.util.List<LogEntry> getErrorLog()
Description copied from interface: BuildLogger
Provide the latest error logs. This is not persisted

Specified by:
getErrorLog in interface BuildLogger
Returns:
The list of LogEntrys. May return null.

getStringErrorLogs

public java.util.List<java.lang.String> getStringErrorLogs()
Specified by:
getStringErrorLogs in interface BuildLogger

getBuildLog

public java.util.List<LogEntry> getBuildLog()
Description copied from interface: BuildLogger
Provide the latest build details (last 100 lines of logs). This is not persisted.

Specified by:
getBuildLog in interface BuildLogger
Returns:
The list of LogEntrys. May return null.

addBuildLogEntry

public java.lang.String addBuildLogEntry(LogEntry logEntry)
Description copied from interface: BuildLogger
Add a new build log entry. This will get appended to the end of the log.

Specified by:
addBuildLogEntry in interface BuildLogger
Parameters:
logEntry - The data being logged
Returns:
The line of text being logged. From LogEntry.getUnstyledLog().

addBuildLogEntry

public java.lang.String addBuildLogEntry(java.lang.String logString)
Description copied from interface: BuildLogger
Create a new build log entry from text to append to logs

Specified by:
addBuildLogEntry in interface BuildLogger
Parameters:
logString - text to create log entry from
Returns:
The line of text being logged. From LogEntry.getUnstyledLog().

addBuildLogHeader

public java.lang.String addBuildLogHeader(java.lang.String logString,
                                          boolean showBothBanner)
Specified by:
addBuildLogHeader in interface BuildLogger

addErrorLogEntry

public java.lang.String addErrorLogEntry(LogEntry logEntry)
Description copied from interface: BuildLogger
Add a new build error log entry. This will get appended to the end of the log and to the end of the errors.

Specified by:
addErrorLogEntry in interface BuildLogger
Parameters:
logEntry - The data being logged
Returns:
The line of text being logged. From LogEntry.getUnstyledLog().

addErrorLogEntry

public java.lang.String addErrorLogEntry(java.lang.String logString)
Description copied from interface: BuildLogger
Add a new build error log entry from text. This will get appended to the end of the log and to the end of the errors.

Specified by:
addErrorLogEntry in interface BuildLogger
Parameters:
logString - The text to create log entry from
Returns:
The line of text being logged. From LogEntry.getUnstyledLog().

clearBuildLog

public void clearBuildLog()
Description copied from interface: BuildLogger
Reset the build log, ready for the next build

Specified by:
clearBuildLog in interface BuildLogger

startStreamingBuildLogs

public void startStreamingBuildLogs(int buildNum,
                                    java.lang.String planKey)
Description copied from interface: BuildLogger
Begin streaming any logs to build logs file

Specified by:
startStreamingBuildLogs in interface BuildLogger

stopStreamingBuildLogs

public void stopStreamingBuildLogs()
Description copied from interface: BuildLogger
Stop streaming any logs to the build logs file

Specified by:
stopStreamingBuildLogs in interface BuildLogger

getTimeOfLastLog

public long getTimeOfLastLog()
Description copied from interface: BuildLogger
last time a log entry was added. If no logs, returns 0

Specified by:
getTimeOfLastLog in interface BuildLogger
Returns:


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.