Class DittoLog

java.lang.Object
com.ditto.java.DittoLog

public class DittoLog extends Object

Main access for Ditto logging API.

This class provides static methods for logging at various levels (error, warning, info, debug, verbose). It is expected to be an internal one, although it cannot be marked as such since it is used by other packages (e.g., ditto, androidtransports).

Tweaking its behavior, however (custom log callback, log file, log level, etc.), is intended to be public / customer facing. That part is thus defined as being part of ditto (our current public-facing package), as the DittoLogging singleton.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    d(@NonNull String tag, @NonNull Object obj)
    Logs a debug message.
    static void
    d(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
    Logs a debug message with an associated throwable.
    static void
    e(@NonNull String tag, @NonNull Object obj)
    Logs an error message.
    static void
    e(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
    Logs an error message with an associated throwable.
    static @NonNull DittoLogDecorator
    Returns the current log decorator used for formatting log messages.
    static void
    i(@NonNull String tag, @NonNull Object obj)
    Logs an informational message.
    static void
    i(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
    Logs an informational message with an associated throwable.
    static void
    setLogDecorator(@NonNull DittoLogDecorator logDecorator)
    Sets a custom log decorator for formatting log messages.
    static void
    v(@NonNull String tag, @NonNull Object obj)
    Logs a verbose message.
    static void
    v(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
    Logs a verbose message with an associated throwable.
    static void
    w(@NonNull String tag, @NonNull Object obj)
    Logs a warning message.
    static void
    w(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
    Logs a warning message with an associated throwable.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getLogDecorator

      public static @NonNull DittoLogDecorator getLogDecorator()
      Returns the current log decorator used for formatting log messages.
      Returns:
      the current DittoLogDecorator instance.
    • setLogDecorator

      public static void setLogDecorator(@NonNull DittoLogDecorator logDecorator)
      Sets a custom log decorator for formatting log messages.
      Parameters:
      logDecorator - the DittoLogDecorator to use for log message formatting.
    • e

      public static void e(@NonNull String tag, @NonNull Object obj)
      Logs an error message.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
    • e

      public static void e(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
      Logs an error message with an associated throwable.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
      throwable - an optional throwable associated with the error.
    • w

      public static void w(@NonNull String tag, @NonNull Object obj)
      Logs a warning message.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
    • w

      public static void w(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
      Logs a warning message with an associated throwable.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
      throwable - an optional throwable associated with the warning.
    • i

      public static void i(@NonNull String tag, @NonNull Object obj)
      Logs an informational message.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
    • i

      public static void i(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
      Logs an informational message with an associated throwable.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
      throwable - an optional throwable associated with the info message.
    • d

      public static void d(@NonNull String tag, @NonNull Object obj)
      Logs a debug message.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
    • d

      public static void d(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
      Logs a debug message with an associated throwable.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
      throwable - an optional throwable associated with the debug message.
    • v

      public static void v(@NonNull String tag, @NonNull Object obj)
      Logs a verbose message.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
    • v

      public static void v(@NonNull String tag, @NonNull Object obj, @Nullable Throwable throwable)
      Logs a verbose message with an associated throwable.
      Parameters:
      tag - a tag to identify the source of the log message.
      obj - the message object to log.
      throwable - an optional throwable associated with the verbose message.