mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Rolled CTX functions into Log
This commit is contained in:
parent
8067e6fec3
commit
25b428cb04
@ -1,33 +0,0 @@
|
||||
package com.riiablo.log;
|
||||
|
||||
import org.apache.logging.log4j.ThreadContext;
|
||||
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
// TODO: support ThreadLocal or convert into ThreadContextMap impl
|
||||
public enum CTX {
|
||||
INSTANCE;
|
||||
|
||||
public static void put(String key, String value) {
|
||||
ThreadContext.put(key, value);
|
||||
// INSTANCE.map.put(key, value);
|
||||
}
|
||||
|
||||
public static void remove(String key) {
|
||||
ThreadContext.remove(key);
|
||||
// INSTANCE.map.remove(key);
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
ThreadContext.clearMap();
|
||||
// INSTANCE.map.clear();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static OrderedMap<String, String> map() {
|
||||
return null;
|
||||
// return INSTANCE.map;
|
||||
}
|
||||
|
||||
// final OrderedMap<String, String> map = new OrderedMap<>();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.riiablo.log;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.ThreadContext;
|
||||
import org.apache.logging.log4j.message.Message;
|
||||
import org.apache.logging.log4j.message.MessageFactory;
|
||||
import org.apache.logging.log4j.message.StringFormatterMessageFactory;
|
||||
@ -31,4 +32,16 @@ public class Log {
|
||||
public static void errorf(Logger logger, Throwable t, String format, Object... args) {
|
||||
logger.error(createMessage(format, args), t);
|
||||
}
|
||||
|
||||
public static void put(String key, String value) {
|
||||
ThreadContext.put(key, value);
|
||||
}
|
||||
|
||||
public static void remove(String key) {
|
||||
ThreadContext.remove(key);
|
||||
}
|
||||
|
||||
public static void clearMap() {
|
||||
ThreadContext.clearMap();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user