MCPcopy Create free account
hub / github.com/GreptimeTeam/rust-java-demo / Logger

Class Logger

core/src/main/java/io/greptime/demo/utils/Logger.java:26–75  ·  view source on GitHub ↗

A simple wrapper of slf4j logger, and more importantly, it's used in Rust code for logging.

Source from the content-addressed store, hash-verified

24 * code for logging.
25 */
26public class Logger {
27
28 private static final ConcurrentMap<String, Logger> LOGGERS = new ConcurrentHashMap<>();
29
30 public static Logger getLogger(Class<?> clazz) {
31 return getLogger(clazz.getName());
32 }
33
34 public static Logger getLogger(String name) {
35 return LOGGERS.computeIfAbsent(name, x -> new Logger(LoggerFactory.getLogger(x)));
36 }
37
38 private final org.slf4j.Logger inner;
39
40 private Logger(org.slf4j.Logger inner) {
41 this.inner = inner;
42 }
43
44 public void error(String msg) {
45 this.inner.error(msg);
46 }
47
48 public void error(String format, Object... arguments) {
49 this.inner.error(format, arguments);
50 }
51
52 public void warn(String msg) {
53 this.inner.warn(msg);
54 }
55
56 public void info(String msg) {
57 this.inner.info(msg);
58 }
59
60 public void info(String format, Object... arguments) {
61 this.inner.info(format, arguments);
62 }
63
64 public void debug(String msg) {
65 this.inner.debug(msg);
66 }
67
68 public void debug(String format, Object... arguments) {
69 this.inner.debug(format, arguments);
70 }
71
72 public void trace(String msg) {
73 this.inner.trace(msg);
74 }
75}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected