Class LogWriterBuilder
java.lang.Object
com.linecorp.armeria.common.logging.LogWriterBuilder
Builds a new
LogWriter.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newly-createdLogWriterbased on the properties of this builder.failureResponseLogLevel(LogLevel failedResponseLogLevel) Sets theLogLevelto use when logging failure responses (e.g., failed with an exception).logFormatter(LogFormatter logFormatter) Sets the name of theLoggerto use when logging.Sets theLoggerto use when logging.requestLogLevel(LogLevel requestLogLevel) Sets theLogLevelto use when logging requests.requestLogLevel(Class<? extends Throwable> clazz, LogLevel requestLogLevel) requestLogLevelMapper(RequestLogLevelMapper requestLogLevelMapper) Sets theRequestLogLevelMapperto use when mapping the log level of request logs.responseCauseFilter(BiPredicate<? super RequestContext, ? super Throwable> responseCauseFilter) Sets thePredicateused for evaluating whether to log the response cause or not.responseLogLevel(HttpStatusClass statusClass, LogLevel logLevel) Sets theLogLevelto use when logging responses whose status belongs to the specifiedHttpStatusClass.responseLogLevel(HttpStatus status, LogLevel logLevel) Sets theLogLevelto use when logging responses whose status is equal to the specifiedHttpStatus.responseLogLevel(Class<? extends Throwable> clazz, LogLevel logLevel) responseLogLevelMapper(ResponseLogLevelMapper responseLogLevelMapper) Sets theResponseLogLevelMapperto use when mapping the log level of response logs.successfulResponseLogLevel(LogLevel successfulResponseLogLevel) Sets theLogLevelto use when logging successful responses (e.g., no unhandled exception).
-
Method Details
-
logger
-
logger
Sets the name of theLoggerto use when logging. This method is a shortcut forthis.logger(LoggerFactory.getLogger(loggerName)). -
requestLogLevel
Sets theLogLevelto use when logging requests. If unset, will useLogLevel.DEBUG. -
requestLogLevel
-
requestLogLevelMapper
Sets theRequestLogLevelMapperto use when mapping the log level of request logs. -
responseLogLevel
Sets theLogLevelto use when logging responses whose status is equal to the specifiedHttpStatus. -
responseLogLevel
Sets theLogLevelto use when logging responses whose status belongs to the specifiedHttpStatusClass. -
responseLogLevel
-
successfulResponseLogLevel
Sets theLogLevelto use when logging successful responses (e.g., no unhandled exception).LogLevel.DEBUGwill be used by default. -
failureResponseLogLevel
Sets theLogLevelto use when logging failure responses (e.g., failed with an exception).LogLevel.WARNwill be used by default. -
responseLogLevelMapper
Sets theResponseLogLevelMapperto use when mapping the log level of response logs. -
responseCauseFilter
public LogWriterBuilder responseCauseFilter(BiPredicate<? super RequestContext, ? super Throwable> responseCauseFilter) -
logFormatter
Sets theLogFormatterwhich converts aRequestOnlyLogorRequestLoginto a log message. By defaultLogFormatter.ofText()will be used.- Throws:
IllegalStateException- If both the log sanitizers and theLogFormatterare specified.
-
build
Returns a newly-createdLogWriterbased on the properties of this builder.
-