Class LogWriterBuilder
java.lang.Object
com.linecorp.armeria.common.logging.LogWriterBuilder
Builds a new
LogWriter
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newly-createdLogWriter
based on the properties of this builder.failureResponseLogLevel
(LogLevel failedResponseLogLevel) Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception).logFormatter
(LogFormatter logFormatter) Sets the name of theLogger
to use when logging.logger
(org.slf4j.Logger logger) Sets theLogger
to use when logging.requestLogLevel
(LogLevel requestLogLevel) Sets theLogLevel
to use when logging requests.requestLogLevel
(Class<? extends Throwable> clazz, LogLevel requestLogLevel) requestLogLevelMapper
(RequestLogLevelMapper requestLogLevelMapper) Sets theRequestLogLevelMapper
to use when mapping the log level of request logs.responseCauseFilter
(Predicate<? super Throwable> responseCauseFilter) Sets thePredicate
used for evaluating whether to log the response cause or not.responseLogLevel
(HttpStatusClass statusClass, LogLevel logLevel) Sets theLogLevel
to use when logging responses whose status belongs to the specifiedHttpStatusClass
.responseLogLevel
(HttpStatus status, LogLevel logLevel) Sets theLogLevel
to use when logging responses whose status is equal to the specifiedHttpStatus
.responseLogLevel
(Class<? extends Throwable> clazz, LogLevel logLevel) responseLogLevelMapper
(ResponseLogLevelMapper responseLogLevelMapper) Sets theResponseLogLevelMapper
to use when mapping the log level of response logs.successfulResponseLogLevel
(LogLevel successfulResponseLogLevel) Sets theLogLevel
to use when logging successful responses (e.g., no unhandled exception).
-
Method Details
-
logger
Sets theLogger
to use when logging. If unset, a defaultLogger
will be used. -
logger
Sets the name of theLogger
to use when logging. This method is a shortcut forthis.logger(LoggerFactory.getLogger(loggerName))
. -
requestLogLevel
Sets theLogLevel
to use when logging requests. If unset, will useLogLevel.DEBUG
. -
requestLogLevel
-
requestLogLevelMapper
Sets theRequestLogLevelMapper
to use when mapping the log level of request logs. -
responseLogLevel
Sets theLogLevel
to use when logging responses whose status is equal to the specifiedHttpStatus
. -
responseLogLevel
Sets theLogLevel
to use when logging responses whose status belongs to the specifiedHttpStatusClass
. -
responseLogLevel
-
successfulResponseLogLevel
Sets theLogLevel
to use when logging successful responses (e.g., no unhandled exception).LogLevel.DEBUG
will be used by default. -
failureResponseLogLevel
Sets theLogLevel
to use when logging failure responses (e.g., failed with an exception).LogLevel.WARN
will be used by default. -
responseLogLevelMapper
Sets theResponseLogLevelMapper
to use when mapping the log level of response logs. -
responseCauseFilter
-
logFormatter
Sets theLogFormatter
which converts aRequestOnlyLog
orRequestLog
into a log message. By defaultLogFormatter.ofText()
will be used.- Throws:
IllegalStateException
- If both the log sanitizers and theLogFormatter
are specified.
-
build
Returns a newly-createdLogWriter
based on the properties of this builder.
-