Class StructuredLogFormatterFactory<E>
java.lang.Object
org.springframework.boot.logging.structured.StructuredLogFormatterFactory<E>
- Type Parameters:
E
- the log even type
Factory that can be used to create a fully instantiated
StructuredLogFormatter
for either a common format
or a
fully-qualified class name.- Since:
- 3.4.0
- Author:
- Moritz Halbritter, Phillip Webb
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Factory used to create aStructuredLogFormatter
for a givenCommonStructuredLogFormat
.static class
Callback used for configure theStructuredLogFormatterFactory.CommonFormatterFactory
to use for a givenCommonStructuredLogFormat
. -
Constructor Summary
ConstructorDescriptionStructuredLogFormatterFactory
(Class<E> logEventType, Environment environment, Consumer<Instantiator.AvailableParameters> availableParameters, Consumer<StructuredLogFormatterFactory.CommonFormatters<E>> commonFormatters) Create a newStructuredLogFormatterFactory
instance. -
Method Summary
Modifier and TypeMethodDescriptionGet a newStructuredLogFormatter
instance for the specified format.
-
Constructor Details
-
StructuredLogFormatterFactory
public StructuredLogFormatterFactory(Class<E> logEventType, Environment environment, Consumer<Instantiator.AvailableParameters> availableParameters, Consumer<StructuredLogFormatterFactory.CommonFormatters<E>> commonFormatters) Create a newStructuredLogFormatterFactory
instance.- Parameters:
logEventType
- the log event typeenvironment
- the SpringEnvironment
availableParameters
- callback used to configure available parameters for the specific logging systemcommonFormatters
- callback used to define supported common formatters
-
-
Method Details
-
get
Get a newStructuredLogFormatter
instance for the specified format.- Parameters:
format
- the format requested (either aCommonStructuredLogFormat
ID or a fully-qualified class name)- Returns:
- a new
StructuredLogFormatter
instance - Throws:
IllegalArgumentException
- if the format is unknown
-