Class SelenideLogger

java.lang.Object
com.codeborne.selenide.logevents.SelenideLogger

@ParametersAreNonnullByDefault public class SelenideLogger extends Object
Logs Selenide test steps and notifies all registered LogEventListener about it
  • Constructor Details

    • SelenideLogger

      public SelenideLogger()
  • Method Details

    • addListener

      public static void addListener(String name, LogEventListener listener)
      Add a listener (to the current thread).
      Parameters:
      name - unique name of this listener (per thread). Can be used later to remove listener using method removeListener(String)
      listener - event listener
    • beginStep

      @CheckReturnValue @Nonnull public static SelenideLog beginStep(String source, String methodName, @Nullable Object... args)
    • getReadableSubject

      @CheckReturnValue @Nonnull public static String getReadableSubject(String methodName, @Nullable Object... args)
    • beginStep

      @CheckReturnValue @Nonnull public static SelenideLog beginStep(String source, String subject)
    • commitStep

      public static void commitStep(SelenideLog log, Throwable error)
    • commitStep

      public static void commitStep(SelenideLog log, LogEvent.EventStatus status)
    • run

      public static void run(String source, String subject, Runnable runnable)
    • get

      @CheckReturnValue public static <T> T get(String source, String subject, Supplier<T> supplier)
    • step

      @CanIgnoreReturnValue public static <T> T step(String source, Supplier<T> supplier)
    • step

      public static void step(String source, Runnable runnable)
    • removeListener

      @Nullable public static <T extends LogEventListener> T removeListener(String name)
      Remove listener (from the current thread).
      Type Parameters:
      T - class of listener to be returned
      Parameters:
      name - unique name of listener added by method addListener(String, LogEventListener)
      Returns:
      the listener being removed
    • removeAllListeners

      public static void removeAllListeners()
    • hasListener

      public static boolean hasListener(String name)
      If listener with given name is bound (added) to the current thread.
      Parameters:
      name - unique name of listener added by method addListener(String, LogEventListener)
      Returns:
      true if method addListener(String, LogEventListener) with corresponding name has been called in current thread.