MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / Logging

Class Logging

src/main/java/core/packetproxy/util/Logging.java:23–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21import packetproxy.gui.GUILog;
22
23public class Logging {
24
25 private static final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
26 private static final GUILog guiLog = GUILog.getInstance();
27
28 private Logging() {
29 }
30
31 public static void log(String format, Object... args) throws IllegalFormatException {
32 LocalDateTime now = LocalDateTime.now();
33 String ns = dtf.format(now);
34 String ss = ns + " " + String.format(format, args);
35 System.out.println(ss);
36 guiLog.append(ss);
37 }
38
39 public static void err(String format, Object... args) throws IllegalFormatException {
40 LocalDateTime now = LocalDateTime.now();
41 String ns = dtf.format(now);
42 String ss = ns + " " + String.format(format, args);
43 System.err.println(ss);
44 guiLog.appendErr(ss);
45 }
46
47 public static void errWithStackTrace(Throwable e) throws IllegalFormatException {
48 err(e.toString());
49 StackTraceElement[] stackTrace = e.getStackTrace();
50 for (var element : stackTrace) {
51 err(element.toString());
52 }
53 }
54}

Callers

nothing calls this directly

Calls 1

getInstanceMethod · 0.95

Tested by

no test coverage detected