Package one.microstream.util.logging
Class Logging
java.lang.Object
one.microstream.util.logging.Logging
public final class Logging extends Object
Static utility collection for various logging purposes.
-
Method Summary
Modifier and Type Method Description static org.slf4j.LoggergetLogger(Class<?> clazz)Get the logging facade for a specific class.static Function<Object,String>getToStringConverter(Object context)Gets the Object to String converter for a specific context, or theDefaultToStringConverter()if none was specified before.static ObjectLazyArg(Object argument)Creates a lazy argument.static ObjectLazyArg(Supplier<?> supplier)Creates a lazy argument.static ObjectLazyArgInContext(Object context, Object argument)Creates a new lazy argument for a specific context, whose Object to String converter will be used.static ObjectLazyArgInContext(Object context, Supplier<?> supplier)Creates a new lazy argument for a specific context, whose Object to String converter will be used.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, ifIterables or arrays are to be converted.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, ifIterables or arrays are to be converted.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, ifIterables or arrays are to be converted.static Function<Object,String>setToStringConverter(Object context, Function<Object,String> converter)Registers an Object to String converter for a specific context.
-
Method Details
-
getLogger
Get the logging facade for a specific class.- Parameters:
clazz- the requesting context- Returns:
- the logging facade
-
getToStringConverter
Gets the Object to String converter for a specific context, or theDefaultToStringConverter()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 forconverter- the Object to String converter- Returns:
- the old converter which was registered before, or null
-
LazyArgInContext
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 forargument- the argument- Returns:
- the lazy object
-
LazyArgInContext
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 forsupplier- the argument supplier- Returns:
- the lazy object
-
LazyArg
Creates a lazy argument. The lazy args'Object.toString()method is only called on demand.- Parameters:
argument- the argument- Returns:
- the lazy argument
-
LazyArg
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
Creates a Object to String converter, which only includes a limited amount of elements in the resulting String, ifIterables or arrays are to be converted.For all other object's
String.valueOf(Object)is used as converter.For example, a
ListofIntegers from 1 to 100, and a limit of 3, will result in aStringlike this:
"[1, 2, 3, ...]"- Parameters:
limit- maximum amount of converted elements inIterables 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, ifIterables or arrays are to be converted.For all other object's the supplied
toStringConverterwill be used.For example, a
ListofIntegers from 1 to 100, and a limit of 3, will result in aStringlike this:
"[1, 2, 3, ...]"- Parameters:
limit- maximum amount of converted elements inIterables and arraystoStringConverter- 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, ifIterables or arrays are to be converted.For all other object's the supplied
toStringConverterwill be used.For example, a
ListofIntegers from 1 to 100, and a limit of 3, will result in aStringlike this:
"[1, 2, 3, ...]"- Parameters:
limitProvider- provides maximum amount of converted elements inIterables and arraystoStringConverter- the converter for all other objects- Returns:
- the new Object to String converter
-