Package dev.alphagame.trailblazer.config
Class LoggerConfigurationBuilder
java.lang.Object
dev.alphagame.trailblazer.config.LoggerConfigurationBuilder
Builder pattern for creating logger configurations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the configuration.static LoggerConfigurationBuilder
create()
Creates a new builder instance.Uses the ColumnedFormatter.withColumnedFormatter
(String columnSeparator, int columnWidth) Uses the ColumnedFormatter with custom settings.withColumnedFormatter
(String columnSeparator, int columnWidth, PrintStream outputStream) Uses the ColumnedFormatter with custom settings and output stream.withFormatter
(AbstractFormatter formatter) Sets a custom formatter.Uses the JSONFormatter.withJSONFormatter
(PrintStream outputStream) Uses the JSONFormatter with custom output stream.withLogLevel
(LogLevel level) Sets the log level.withOutputStream
(PrintStream outputStream) Sets the output stream for the current formatter.Uses the SimpleFormatter.withSimpleFormatter
(PrintStream outputStream) Uses the SimpleFormatter with custom output stream.withSimpleFormatter
(String dateFormat) Uses the SimpleFormatter with custom date format.withSimpleFormatter
(String dateFormat, PrintStream outputStream) Uses the SimpleFormatter with custom date format and output stream.
-
Constructor Details
-
LoggerConfigurationBuilder
public LoggerConfigurationBuilder()
-
-
Method Details
-
create
Creates a new builder instance.- Returns:
- A new LoggerConfigurationBuilder.
-
withLogLevel
Sets the log level.- Parameters:
level
- The log level to set.- Returns:
- This builder instance.
-
withFormatter
Sets a custom formatter.- Parameters:
formatter
- The formatter to use.- Returns:
- This builder instance.
-
withSimpleFormatter
Uses the SimpleFormatter.- Returns:
- This builder instance.
-
withSimpleFormatter
Uses the SimpleFormatter with custom date format.- Parameters:
dateFormat
- The date format pattern.- Returns:
- This builder instance.
-
withSimpleFormatter
Uses the SimpleFormatter with custom output stream.- Parameters:
outputStream
- The output stream to write to.- Returns:
- This builder instance.
-
withSimpleFormatter
Uses the SimpleFormatter with custom date format and output stream.- Parameters:
dateFormat
- The date format pattern.outputStream
- The output stream to write to.- Returns:
- This builder instance.
-
withJSONFormatter
Uses the JSONFormatter.- Returns:
- This builder instance.
-
withJSONFormatter
Uses the JSONFormatter with custom output stream.- Parameters:
outputStream
- The output stream to write to.- Returns:
- This builder instance.
-
withColumnedFormatter
Uses the ColumnedFormatter.- Returns:
- This builder instance.
-
withColumnedFormatter
Uses the ColumnedFormatter with custom settings.- Parameters:
columnSeparator
- The separator between columns.columnWidth
- The width of each column.- Returns:
- This builder instance.
-
withColumnedFormatter
public LoggerConfigurationBuilder withColumnedFormatter(String columnSeparator, int columnWidth, PrintStream outputStream) Uses the ColumnedFormatter with custom settings and output stream.- Parameters:
columnSeparator
- The separator between columns.columnWidth
- The width of each column.outputStream
- The output stream to write to.- Returns:
- This builder instance.
-
withOutputStream
Sets the output stream for the current formatter.- Parameters:
outputStream
- The output stream to write to.- Returns:
- This builder instance.
-
build
Builds the configuration.- Returns:
- A new LoggerConfiguration with the specified settings.
-