Interface MethodTrace


public interface MethodTrace
A method trace.
  • Method Details

    • method

      String method()
      Returns:
      the name of the method being traced
    • message

      @Nullable String message()
      Returns:
      the trace message
    • duration

      long duration()
      Returns the duration of the method call this entry represents in nanoseconds, this value is 0 or undefined until the trace has been completed.
      Returns:
      the duration of the method call this trace represents
    • children

      List<MethodTrace> children()
      Returns:
      the child method traces
    • appendTo

      void appendTo(StringBuilder builder)
      Appends this method trace along with any children to the given StringBuilder.
      Parameters:
      builder - the StringBuilder to append to.
    • toString

      String toString(int indentation)
      Returns a string representation of this method trace.
      Parameters:
      indentation - the number of tab indents to prefix the string with
      Returns:
      a string representation of this method trace
    • addChild

      void addChild(MethodTrace trace)
      Parameters:
      trace - the child trace to add
      Throws:
      IllegalStateException - in case this trace is already completed
    • complete

      void complete(@Nullable Exception exception, @Nullable String message)
      Completes this method trace.
      Parameters:
      exception - the exception, if any
      message - the exit message, if any
      Throws:
      IllegalStateException - in case this trace is completed
    • methodTrace

      static MethodTrace methodTrace(String method, @Nullable String message)
      Parameters:
      method - the method to trace
      message - the message, if any
      Returns:
      a new MethodTrace instance