Class BuildLogUtils
- java.lang.Object
-
- com.atlassian.bamboo.build.logger.BuildLogUtils
-
public class BuildLogUtils extends Object
Provides text parsing utilities for writing and reading build log files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull LogEntryconvertSpecsLogToLogEntry(@Nullable String rawLogEntry)Converts a line from a specs execution log file into a LogEntry objectstatic @NotNull LogEntryconvertToLogEntry(@Nullable String fileEntry)Converts a line from a file back into a LogEntry objectstatic StringconvertToLogFileEntry(@NotNull LogEntry logEntry)Convert the specified LogEntry object into a string to be written to a log filestatic @NotNull Class<? extends LogEntry>getLogEntryType(@NotNull String logLine)Return the specific type ofLogEntryfor the given log line.static booleanisSpecsLogEntryWithDate(@NotNull String[] split)static voidsendFileThroughLogger(@NotNull File file, @NotNull BuildLogger buildLogger)static voidskipLines(int numLogs, int totalLines, org.apache.commons.io.LineIterator lineIterator)Skips lines until onlynumLogsremains in the givelineIterator.static @NotNull String[]splitLogEntry(@Nullable String fileEntry)static @NotNull String[]splitSpecsLogEntry(@Nullable String rawLogEntry)
-
-
-
Method Detail
-
convertToLogFileEntry
public static String convertToLogFileEntry(@NotNull @NotNull LogEntry logEntry)
Convert the specified LogEntry object into a string to be written to a log file- Parameters:
logEntry- the LogEntry to be written- Returns:
- String file entry, should never be empty
-
getLogEntryType
@NotNull public static @NotNull Class<? extends LogEntry> getLogEntryType(@NotNull @NotNull String logLine)
Return the specific type ofLogEntryfor the given log line.
-
convertToLogEntry
@NotNull public static @NotNull LogEntry convertToLogEntry(@Nullable @Nullable String fileEntry)
Converts a line from a file back into a LogEntry object- Parameters:
fileEntry- to be converted- Returns:
- the resulting LogEntry object
-
convertSpecsLogToLogEntry
@NotNull public static @NotNull LogEntry convertSpecsLogToLogEntry(@Nullable @Nullable String rawLogEntry)
Converts a line from a specs execution log file into a LogEntry object- Parameters:
rawLogEntry- specs execution log line to be converted- Returns:
- the resulting LogEntry object
-
isSpecsLogEntryWithDate
public static boolean isSpecsLogEntryWithDate(@NotNull @NotNull String[] split)- Returns:
- true if date is present in given log split, false otherwise (for pre 6.10 logs)
-
splitLogEntry
@Internal @NotNull public static @NotNull String[] splitLogEntry(@Nullable @Nullable String fileEntry)
-
splitSpecsLogEntry
@Internal @NotNull public static @NotNull String[] splitSpecsLogEntry(@Nullable @Nullable String rawLogEntry)
-
sendFileThroughLogger
public static void sendFileThroughLogger(@NotNull @NotNull File file, @NotNull @NotNull BuildLogger buildLogger) throws IOException- Throws:
IOException
-
skipLines
public static void skipLines(int numLogs, int totalLines, org.apache.commons.io.LineIterator lineIterator)Skips lines until onlynumLogsremains in the givelineIterator.
-
-