Class Logging

java.lang.Object
one.microstream.util.logging.Logging

public final class Logging
extends Object
Static utility collection for various logging purposes.
  • Method Details

    • getLogger

      public static org.slf4j.Logger getLogger​(Class<?> clazz)
      Get the logging facade for a specific class.
      Parameters:
      clazz - the requesting context
      Returns:
      the logging facade
    • getToStringConverter

      public static Function<Object,​String> getToStringConverter​(Object context)
      Gets the Object to String converter for a specific context, or the DefaultToStringConverter() if none was specified before.
      Parameters:
      context - the requesting context
      Returns:
      an Object to String converter
    • setToStringConverter

      public static Function<Object,​String> setToStringConverter​(Object context, Function<Object,​String> converter)
      Registers an Object to String converter for a specific context.
      Parameters:
      context - the context to register the converter for
      converter - the Object to String converter
      Returns:
      the old converter which was registered before, or null
    • LazyArgInContext

      public static final Object LazyArgInContext​(Object context, Object argument)
      Creates a new lazy argument for a specific context, whose Object to String converter will be used. The lazy args' Object.toString() method is only called on demand.
      Parameters:
      context - the context to register the lazy arg for
      argument - the argument
      Returns:
      the lazy object
    • LazyArgInContext

      public static final Object LazyArgInContext​(Object context, Supplier<?> supplier)
      Creates a new lazy argument for a specific context, whose Object to String converter will be used. The lazy args' Object.toString() method is only called on demand.
      Parameters:
      context - the context to register the lazy arg for
      supplier - the argument supplier
      Returns:
      the lazy object
    • LazyArg

      public static final Object LazyArg​(Object argument)
      Creates a lazy argument. The lazy args' Object.toString() method is only called on demand.
      Parameters:
      argument - the argument
      Returns:
      the lazy argument
    • LazyArg

      public static final Object LazyArg​(Supplier<?> supplier)
      Creates a lazy argument. The lazy args' Object.toString() method is only called on demand.
      Parameters:
      supplier - the argument supplier
      Returns:
      the lazy object
    • LimitedElementsToStringConverter

      public static Function<Object,​String> LimitedElementsToStringConverter​(int limit)
      Creates a Object to String converter, which only includes a limited amount of elements in the resulting String, if Iterables or arrays are to be converted.

      For all other object's String.valueOf(Object) is used as converter.

      For example, a List of Integers from 1 to 100, and a limit of 3, will result in a String like this:
      "[1, 2, 3, ...]"

      Parameters:
      limit - maximum amount of converted elements in Iterables and arrays
      Returns:
      the new Object to String converter
    • LimitedElementsToStringConverter

      public static Function<Object,​String> LimitedElementsToStringConverter​(int limit, Function<Object,​String> toStringConverter)
      Creates a Object to String converter, which only includes a limited amount of elements in the resulting String, if Iterables or arrays are to be converted.

      For all other object's the supplied toStringConverter will be used.

      For example, a List of Integers from 1 to 100, and a limit of 3, will result in a String like this:
      "[1, 2, 3, ...]"

      Parameters:
      limit - maximum amount of converted elements in Iterables and arrays
      toStringConverter - the converter for all other objects
      Returns:
      the new Object to String converter
    • LimitedElementsToStringConverter

      public static Function<Object,​String> LimitedElementsToStringConverter​(ToIntFunction<Object> limitProvider, Function<Object,​String> toStringConverter)
      Creates a Object to String converter, which only includes a limited amount of elements in the resulting String, if Iterables or arrays are to be converted.

      For all other object's the supplied toStringConverter will be used.

      For example, a List of Integers from 1 to 100, and a limit of 3, will result in a String like this:
      "[1, 2, 3, ...]"

      Parameters:
      limitProvider - provides maximum amount of converted elements in Iterables and arrays
      toStringConverter - the converter for all other objects
      Returns:
      the new Object to String converter