Class TimestampNote

java.lang.Object
hudson.console.ConsoleNote<Object>
hudson.plugins.timestamper.TimestampNote
All Implemented Interfaces:
ExtensionPoint, Describable<ConsoleNote<?>>, Serializable

public final class TimestampNote extends ConsoleNote<Object>
Time-stamp console note.

These are inserted into the log file when:

  • Running a Pipeline build or any other build which does not extend AbstractBuild prior to version 1.9 OR
  • Running a Freestyle build or any other build which extends AbstractBuild prior to version 1.4 OR
  • Running a Freestyle build or any other build which extends AbstractBuild and the system property is set: (getSystemProperty()). This is intended to support scripts that were written prior to version 1.4 to parse the log files. New scripts should query the /timestamps URL instead (see TimestampsAction).

Otherwise, the time-stamps are stored in a separate file, which allows a more compact format to be used and avoids filling the log files with encoded console notes.

Author:
Steven G. Brown
See Also:
  • Constructor Details

    • TimestampNote

      public TimestampNote(long elapsedMillis, long millisSinceEpoch)
      Create a new TimestampNote.
      Parameters:
      elapsedMillis - the elapsed time in milliseconds since the start of the build
      millisSinceEpoch - milliseconds since the epoch
  • Method Details

    • getSystemProperty

      public static String getSystemProperty()
      Get the system property which will cause these console notes to be inserted into the console log file.
      Returns:
      the system property
    • useTimestampNotes

      public static boolean useTimestampNotes(Class<?> buildClass)
      Returns:
      whether time-stamp notes apply to that type of build
    • getTimestamp

      public Timestamp getTimestamp(Object context)
      Get the time-stamp recorded by this console note.
      Parameters:
      context - the object that owns the console output in question
      Returns:
      the time-stamp
    • annotate

      public ConsoleAnnotator<Object> annotate(Object context, MarkupText text, int charPos)
      Specified by:
      annotate in class ConsoleNote<Object>
    • toString

      public String toString()
      Overrides:
      toString in class Object