- java.lang.Object
-
- com.github.robtimus.pool.PoolLogger.Builder
-
- Enclosing class:
- PoolLogger
public static final class PoolLogger.Builder extends Object
A builder forPoolLoggerobjects.- Author:
- Rob Spoor
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PoolLoggerbuild()Creates a newPoolLoggerobject based on the settings of this builder.PoolLogger.BuilderwithLoggerClass(Class<?> loggerClass)Sets the name of the logger to use.PoolLogger.BuilderwithLoggerName(String loggerName)Sets the name of the logger to use.PoolLogger.BuilderwithMessagePrefix(String messagePrefix)Sets the message prefix to use.PoolLogger.BuilderwithObjectPrefix(String objectPrefix)Sets the object prefix to use.
-
-
-
Method Detail
-
withLoggerName
public PoolLogger.Builder withLoggerName(String loggerName)
Sets the name of the logger to use. The default is the name of thePoolclass.- Parameters:
loggerName- The name of the logger to use.- Returns:
- This builder.
- Throws:
NullPointerException- If the given logger name isnull.
-
withLoggerClass
public PoolLogger.Builder withLoggerClass(Class<?> loggerClass)
Sets the name of the logger to use. This method is shorthand for callingwithLoggerName(String)with the given class' fully qualified name.- Parameters:
loggerClass- The class to use for the name of the logger to use.- Returns:
- This builder.
- Throws:
NullPointerException- If the given logger class isnull.
-
withMessagePrefix
public PoolLogger.Builder withMessagePrefix(String messagePrefix)
Sets the message prefix to use. This is prepended to each logged message. The default is no prefix.- Parameters:
messagePrefix- The message prefix to use.- Returns:
- This builder.
- Throws:
NullPointerException- If the given message prefix isnull.
-
withObjectPrefix
public PoolLogger.Builder withObjectPrefix(String objectPrefix)
Sets the object prefix to use. This is prepended to object ids in each logged message. The default isobject-.- Parameters:
objectPrefix- The object prefix to use.- Returns:
- This builder.
- Throws:
NullPointerException- If the given object prefix isnull.
-
build
public PoolLogger build()
Creates a newPoolLoggerobject based on the settings of this builder.- Returns:
- The created
PoolLoggerobject.
-
-