@Immutable public final class LogHelper extends Object
IErrorLevel enum in
this package with SLF4J logger.| Modifier and Type | Class and Description |
|---|---|
static interface |
LogHelper.IFuncIsLoggingEnabled
Abstraction interface for
logger.is...Enabled () depending on
the error level. |
static interface |
LogHelper.IFuncLogger
Abstraction interface for
logger.debug or
logger.info depending on the error level. |
| Modifier and Type | Method and Description |
|---|---|
static LogHelper.IFuncIsLoggingEnabled |
getFuncIsEnabled(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel) |
static LogHelper.IFuncLogger |
getFuncLogger(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel) |
static boolean |
isEnabled(Class<?> aLoggingClass,
IErrorLevel aErrorLevel)
Check if logging is enabled for the passed class based on the error level
provided
|
static boolean |
isEnabled(Class<?> aLoggingClass,
IHasErrorLevel aErrorLevelProvider)
Check if logging is enabled for the passed class based on the error level
provider by the passed object
|
static boolean |
isEnabled(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel)
Check if logging is enabled for the passed logger based on the error level
provided
|
static boolean |
isEnabled(org.slf4j.Logger aLogger,
IHasErrorLevel aErrorLevelProvider)
Check if logging is enabled for the passed logger based on the error level
provider by the passed object
|
static void |
log(Class<?> aLoggingClass,
IErrorLevel aErrorLevel,
String sMsg)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IErrorLevel aErrorLevel,
String sMsg,
Throwable t)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IErrorLevel aErrorLevel,
Supplier<String> aMsgSupplier)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IErrorLevel aErrorLevel,
Supplier<String> aMsgSupplier,
Throwable t)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IHasErrorLevel aErrorLevelProvider,
String sMsg)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IHasErrorLevel aErrorLevelProvider,
String sMsg,
Throwable t)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IHasErrorLevel aErrorLevelProvider,
Supplier<String> aMsgSupplier)
Generically log something
|
static void |
log(Class<?> aLoggingClass,
IHasErrorLevel aErrorLevelProvider,
Supplier<String> aMsgSupplier,
Throwable t)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel,
String sMsg)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel,
String sMsg,
Throwable t)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel,
Supplier<String> aMsgSupplier)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IErrorLevel aErrorLevel,
Supplier<String> aMsgSupplier,
Throwable t)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IHasErrorLevel aErrorLevelProvider,
String sMsg)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IHasErrorLevel aErrorLevelProvider,
String sMsg,
Throwable t)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IHasErrorLevel aErrorLevelProvider,
Supplier<String> aMsgSupplier)
Generically log something
|
static void |
log(org.slf4j.Logger aLogger,
IHasErrorLevel aErrorLevelProvider,
Supplier<String> aMsgSupplier,
Throwable t)
Generically log something
|
@Nonnull public static LogHelper.IFuncIsLoggingEnabled getFuncIsEnabled(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel)
@Nonnull public static LogHelper.IFuncLogger getFuncLogger(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel)
public static boolean isEnabled(@Nonnull Class<?> aLoggingClass, @Nonnull IHasErrorLevel aErrorLevelProvider)
aLoggingClass - The class to determine the logger from. May not be null
.aErrorLevelProvider - The error level provider. May not be null.true if the respective log level is allowed,
false if notpublic static boolean isEnabled(@Nonnull org.slf4j.Logger aLogger, @Nonnull IHasErrorLevel aErrorLevelProvider)
aLogger - The logger. May not be null.aErrorLevelProvider - The error level provider. May not be null.true if the respective log level is allowed,
false if notpublic static boolean isEnabled(@Nonnull Class<?> aLoggingClass, @Nonnull IErrorLevel aErrorLevel)
aLoggingClass - The class to determine the logger from. May not be null
.aErrorLevel - The error level. May not be null.true if the respective log level is allowed,
false if notpublic static boolean isEnabled(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel)
aLogger - The logger. May not be null.aErrorLevel - The error level. May not be null.true if the respective log level is allowed,
false if notpublic static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull String sMsg)
aLoggingClass - Logging class to use. May not be null.aErrorLevelProvider - Error level provided to use. May not be null.sMsg - The message to log. May not be null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull String sMsg, @Nullable Throwable t)
aLoggingClass - Logging class to use. May not be null.aErrorLevelProvider - Error level provided to use. May not be null.sMsg - The message to log. May not be null.t - Optional exception that occurred. May be null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull String sMsg)
aLogger - Logger to use. May not be null.aErrorLevelProvider - Error level provider to use. May not be null.sMsg - The message to log. May not be null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull String sMsg, @Nullable Throwable t)
aLogger - Logger to use. May not be null.aErrorLevelProvider - Error level provider to use. May not be null.sMsg - The message to log. May not be null.t - Optional exception that occurred. May be null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IErrorLevel aErrorLevel, @Nonnull String sMsg)
aLoggingClass - Logging class to use. May not be null.aErrorLevel - Error level to use. May not be null.sMsg - The message to log. May not be null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IErrorLevel aErrorLevel, @Nonnull String sMsg, @Nullable Throwable t)
aLoggingClass - Logging class to use. May not be null.aErrorLevel - Error level to use. May not be null.sMsg - The message to log. May not be null.t - Optional exception that occurred. May be null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel, @Nonnull String sMsg)
aLogger - Logger to use. May not be null.aErrorLevel - Error level to use. May not be null.sMsg - The message to log. May not be null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel, @Nonnull String sMsg, @Nullable Throwable t)
aLogger - Logger to use. May not be null.aErrorLevel - Error level to use. May not be null.sMsg - The message to log. May not be null.t - Optional exception that occurred. May be null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull Supplier<String> aMsgSupplier)
aLoggingClass - Logging class to use. May not be null.aErrorLevelProvider - Error level provided to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull Supplier<String> aMsgSupplier, @Nullable Throwable t)
aLoggingClass - Logging class to use. May not be null.aErrorLevelProvider - Error level provided to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.t - Optional exception that occurred. May be null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull Supplier<String> aMsgSupplier)
aLogger - Logger to use. May not be null.aErrorLevelProvider - Error level provider to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IHasErrorLevel aErrorLevelProvider, @Nonnull Supplier<String> aMsgSupplier, @Nullable Throwable t)
aLogger - Logger to use. May not be null.aErrorLevelProvider - Error level provider to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.t - Optional exception that occurred. May be null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IErrorLevel aErrorLevel, @Nonnull Supplier<String> aMsgSupplier)
aLoggingClass - Logging class to use. May not be null.aErrorLevel - Error level to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.public static void log(@Nonnull Class<?> aLoggingClass, @Nonnull IErrorLevel aErrorLevel, @Nonnull Supplier<String> aMsgSupplier, @Nullable Throwable t)
aLoggingClass - Logging class to use. May not be null.aErrorLevel - Error level to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.t - Optional exception that occurred. May be null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel, @Nonnull Supplier<String> aMsgSupplier)
aLogger - Logger to use. May not be null.aErrorLevel - Error level to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.public static void log(@Nonnull org.slf4j.Logger aLogger, @Nonnull IErrorLevel aErrorLevel, @Nonnull Supplier<String> aMsgSupplier, @Nullable Throwable t)
aLogger - Logger to use. May not be null.aErrorLevel - Error level to use. May not be null.aMsgSupplier - Message supplier to use. The supplier is only invoked if the log
level is enabled on the provided logger. May not be
null.t - Optional exception that occurred. May be null.Copyright © 2014–2020 Philip Helger. All rights reserved.