Class AbstractBuildLogger
- java.lang.Object
-
- com.atlassian.bamboo.build.logger.AbstractBuildLogger
-
- All Implemented Interfaces:
BuildLogger
,BuildLoggerWithoutLogAccess
- Direct Known Subclasses:
BuildLoggerImpl
,RemoteBuildLogger
public abstract class AbstractBuildLogger extends Object implements BuildLogger
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
MAX_BUILDLOG_SIZE
-
Constructor Summary
Constructors Constructor Description AbstractBuildLogger(String linePrefix)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @NotNull String
addBuildLogEntry(@NotNull LogEntry logEntry)
Add a new build log entry.@NotNull String
addBuildLogEntry(@NotNull String logString)
Create a new build log entry from text to append to logs@NotNull String
addErrorLogEntry(@NotNull LogEntry logEntry)
Add a new build error log entry.@NotNull String
addErrorLogEntry(String logString)
Add a new build error log entry from text.void
addErrorLogEntry(String logString, @Nullable Throwable e)
Adds an error log entry and each frame of the stack trace as a new error log entryprotected String
addErrorLogEntryInternal(@NotNull LogEntry logEntry)
protected @NotNull String
addLogEntry(@NotNull LogEntry logEntry)
void
close()
@NotNull List<LogEntry>
getBuildLog()
@NotNull List<LogEntry>
getErrorLog()
@NotNull LogInterceptorStack
getInterceptorStack()
@NotNull List<LogEntry>
getLastNLogEntries(int n)
Provide the latest build details (last n lines of logs).int
getLogEntryCount()
Total number of log entries.@NotNull LogMutatorStack
getMutatorStack()
long
getTimeOfLastLog()
last time a log entry was added.protected @NotNull LogEntry
interceptAndMutate(@NotNull LogEntry logEntry)
protected @NotNull LogEntry
interceptAndMutateError(@NotNull LogEntry logEntry)
abstract void
onAddLogEntry(@NotNull LogEntry logEntry)
void
setTimeOfLastLog(long timeOfLastLog)
set time of last log.abstract 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
-
Methods inherited from interface com.atlassian.bamboo.build.logger.BuildLoggerWithoutLogAccess
isPersistent, transfersLogsAsArtifact
-
-
-
-
Field Detail
-
MAX_BUILDLOG_SIZE
protected static final int MAX_BUILDLOG_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractBuildLogger
public AbstractBuildLogger(String linePrefix)
-
-
Method Detail
-
onAddLogEntry
public abstract void onAddLogEntry(@NotNull @NotNull LogEntry logEntry)
-
stopStreamingBuildLogs
public abstract void stopStreamingBuildLogs()
Description copied from interface:BuildLoggerWithoutLogAccess
Stop streaming any logs to the build logs file- Specified by:
stopStreamingBuildLogs
in interfaceBuildLoggerWithoutLogAccess
-
getLogEntryCount
public int getLogEntryCount()
Description copied from interface:BuildLogger
Total number of log entries.- Specified by:
getLogEntryCount
in interfaceBuildLogger
-
getLastNLogEntries
@NotNull public @NotNull List<LogEntry> getLastNLogEntries(int n)
Description copied from interface:BuildLogger
Provide the latest build details (last n lines of logs). This is not persisted.- Specified by:
getLastNLogEntries
in interfaceBuildLogger
- Returns:
- The list of
LogEntry
s.
-
addBuildLogEntry
@NotNull public @NotNull String addBuildLogEntry(@NotNull @NotNull LogEntry logEntry)
Description copied from interface:BuildLoggerWithoutLogAccess
Add a new build log entry. This will get appended to the end of the log.- Specified by:
addBuildLogEntry
in interfaceBuildLoggerWithoutLogAccess
- Parameters:
logEntry
- The data being logged- Returns:
- The line of text being logged. From
LogEntry.getUnstyledLog()
.
-
addErrorLogEntry
@NotNull public @NotNull String addErrorLogEntry(@NotNull @NotNull LogEntry logEntry)
Description copied from interface:BuildLoggerWithoutLogAccess
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 interfaceBuildLoggerWithoutLogAccess
- Parameters:
logEntry
- The data being logged- Returns:
- The line of text being logged. From
LogEntry.getUnstyledLog()
.
-
addErrorLogEntryInternal
protected String addErrorLogEntryInternal(@NotNull @NotNull LogEntry logEntry)
-
interceptAndMutate
@NotNull protected @NotNull LogEntry interceptAndMutate(@NotNull @NotNull LogEntry logEntry)
-
interceptAndMutateError
@NotNull protected @NotNull LogEntry interceptAndMutateError(@NotNull @NotNull LogEntry logEntry)
-
addBuildLogEntry
@NotNull public @NotNull String addBuildLogEntry(@NotNull @NotNull String logString)
Description copied from interface:BuildLoggerWithoutLogAccess
Create a new build log entry from text to append to logs- Specified by:
addBuildLogEntry
in interfaceBuildLoggerWithoutLogAccess
- Parameters:
logString
- text to create log entry from- Returns:
- The line of text being logged. From
LogEntry.getUnstyledLog()
.
-
addErrorLogEntry
@NotNull public @NotNull String addErrorLogEntry(String logString)
Description copied from interface:BuildLoggerWithoutLogAccess
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 interfaceBuildLoggerWithoutLogAccess
- Parameters:
logString
- The text to create log entry from- Returns:
- The line of text being logged. From
LogEntry.getUnstyledLog()
.
-
addErrorLogEntry
public void addErrorLogEntry(String logString, @Nullable @Nullable Throwable e)
Description copied from interface:BuildLoggerWithoutLogAccess
Adds an error log entry and each frame of the stack trace as a new error log entry- Specified by:
addErrorLogEntry
in interfaceBuildLoggerWithoutLogAccess
-
getTimeOfLastLog
public long getTimeOfLastLog()
Description copied from interface:BuildLoggerWithoutLogAccess
last time a log entry was added. If no logs, returns 0- Specified by:
getTimeOfLastLog
in interfaceBuildLoggerWithoutLogAccess
- Returns:
-
setTimeOfLastLog
public void setTimeOfLastLog(long timeOfLastLog)
Description copied from interface:BuildLoggerWithoutLogAccess
set time of last log. Used for loading buildings in progress after restarts- Specified by:
setTimeOfLastLog
in interfaceBuildLoggerWithoutLogAccess
-
getInterceptorStack
@NotNull public @NotNull LogInterceptorStack getInterceptorStack()
- Specified by:
getInterceptorStack
in interfaceBuildLoggerWithoutLogAccess
- Returns:
- stack of log interceptors attached to this build logger
-
getMutatorStack
@NotNull public @NotNull LogMutatorStack getMutatorStack()
- Specified by:
getMutatorStack
in interfaceBuildLoggerWithoutLogAccess
- Returns:
- stack of log mutators attached to this build logger
-
close
public void close()
- Specified by:
close
in interfaceBuildLoggerWithoutLogAccess
-
-