Class SLogger.Formatter
- java.lang.Object
-
- com.identityworksllc.iiq.common.logging.SLogger.Formatter
-
- Enclosing class:
- SLogger
public static class SLogger.Formatter extends Object implements Supplier<String>
Container class to format an object for logging.The format is only derived when
toString()is called, meaning that if you log one of these and the log level is not enabled, a slow string conversion will never occur.Null values are transformed into the special string ‘(null)’.
Formatted values are cached after the first format operation, even if the underlying object is modified.
The following types are handled by the Formatter:
- null
- Strings
- Arrays of Objects
- Arrays of StackTraceElements
- Collections of Objects
- Maps
- Dates and Calendars
- XML
Documents - Various SailPointObjects
Nested objects (e.g., the items in a list) are also passed through Formatter.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Stringformat(Object obj)Formats the given object for loggingStringget()Returns the formatted string of the item when invoked via theSupplierinterface.StringtoString()If the formatted value exists, the cached version will be returned.
-
-
-
Method Detail
-
format
public static String format(Object obj)
Formats the given object for logging- Parameters:
obj- The object to format- Returns:
- The formatted object
-
get
public String get()
Returns the formatted string of the item when invoked via theSupplierinterface.This output will NOT be cached, unlike a call to toString().
- Specified by:
getin interfaceSupplier<String>- Returns:
- The formatted string, freshly calculated
- See Also:
Supplier.get()
-
toString
public String toString()
If the formatted value exists, the cached version will be returned.Otherwise, the format string will be calculated at this time, cached, and then returned.
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
-