Package io.cui.tools.logging
Class LogRecordModel
- java.lang.Object
-
- io.cui.tools.logging.LogRecordModel
-
- All Implemented Interfaces:
LogRecord
public class LogRecordModel extends Object implements LogRecord
Represents a log-entry. Especially focuses on enforcing log-entry identifier, seegetPrefix()andgetIdentifier(). The template mechanism is the same as withCuiLogger, saying it accepts as well '%s' and '{}' as placeholder, even mixed. To simplify usage the prefix string will always be prepended on callingformat(Object...)- Author:
- Oliver Wolff
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogRecordModel.LogRecordModelBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LogRecordModel.LogRecordModelBuilderbuilder()Stringformat(Object... parameter)Formats the template with the given object.@NonNull IntegergetIdentifier()protected StringgetParsedMessageTemplate()@NonNull StringgetPrefix()@NonNull StringgetTemplate()StringresolveIdentifierString()Supplier<String>supplier(Object... parameter)Returns aSupplierview on the formatter
-
-
-
Method Detail
-
getParsedMessageTemplate
protected String getParsedMessageTemplate()
-
format
public String format(Object... parameter)
Description copied from interface:LogRecordFormats the template with the given object. Important: it implicitly prepends the identifier, e.g. "CUI-100: " in front of the created message.
-
supplier
public Supplier<String> supplier(Object... parameter)
Description copied from interface:LogRecordReturns aSupplierview on the formatter
-
resolveIdentifierString
public String resolveIdentifierString()
- Specified by:
resolveIdentifierStringin interfaceLogRecord- Returns:
- the concatenated identifier String, e.g. CUI-100
-
builder
public static LogRecordModel.LogRecordModelBuilder builder()
-
getIdentifier
@NonNull public @NonNull Integer getIdentifier()
- Specified by:
getIdentifierin interfaceLogRecord- Returns:
- the identifier for the concrete entry, e.g. '100'
-
getTemplate
@NonNull public @NonNull String getTemplate()
- Specified by:
getTemplatein interfaceLogRecord- Returns:
- The message template for creating the log-message
-
-