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.Logger
getLogger(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 Object
LazyArg(Object argument)
Creates a lazy argument.static Object
LazyArg(Supplier<?> supplier)
Creates a lazy argument.static Object
LazyArgInContext(Object context, Object argument)
Creates a new lazy argument for a specific context, whose Object to String converter will be used.static Object
LazyArgInContext(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, ifIterable
s 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, ifIterable
s 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, ifIterable
s 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, ifIterable
s or arrays are to be converted.For all other object's
String.valueOf(Object)
is used as converter.For example, a
List
ofInteger
s from 1 to 100, and a limit of 3, will result in aString
like this:
"[1, 2, 3, ...]"
- Parameters:
limit
- maximum amount of converted elements inIterable
s 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, ifIterable
s or arrays are to be converted.For all other object's the supplied
toStringConverter
will be used.For example, a
List
ofInteger
s from 1 to 100, and a limit of 3, will result in aString
like this:
"[1, 2, 3, ...]"
- Parameters:
limit
- maximum amount of converted elements inIterable
s 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, ifIterable
s or arrays are to be converted.For all other object's the supplied
toStringConverter
will be used.For example, a
List
ofInteger
s from 1 to 100, and a limit of 3, will result in aString
like this:
"[1, 2, 3, ...]"
- Parameters:
limitProvider
- provides maximum amount of converted elements inIterable
s and arraystoStringConverter
- the converter for all other objects- Returns:
- the new Object to String converter
-