public class LogUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_BUCKET_ID |
static String |
KEY_GATEWAY_ID |
static String |
KEY_GUILD_ID |
static String |
KEY_REQUEST_ID |
static String |
KEY_SHARD_ID |
| Constructor and Description |
|---|
LogUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Function<Context,Context> |
clearContext() |
static String |
format(Context context,
String msg)
Format a message by unwrapping certain
Context values as metadata, and if they exist, prepend them to
the given message. |
static String |
formatValue(Object value,
int maxLength)
|
static void |
traceDebug(Logger logger,
Function<Boolean,String> messageFactory)
Log a message depending on the enabled level for a given
Logger. |
public static final String KEY_BUCKET_ID
public static final String KEY_REQUEST_ID
public static final String KEY_GATEWAY_ID
public static final String KEY_SHARD_ID
public static final String KEY_GUILD_ID
public static String format(Context context, String msg)
Context values as metadata, and if they exist, prepend them to
the given message.context - a Reactor context to enrich the logging messagemsg - the logging messagepublic static String formatValue(@Nullable Object value, int maxLength)
value - the value to formatmaxLength - maximum length of the formatted value if positive or impose no limit otherwise.public static void traceDebug(Logger logger, Function<Boolean,String> messageFactory)
Logger. The supplied message factory will be
applied with true if the logger has trace level enabled, given by Logger.isTraceEnabled(), o
false otherwise.logger - the logger instance used for logging a messagemessageFactory - a Function that takes true value if the given logger has trace level
enabled, false otherwise, and produces a message to log.