MCPcopy Index your code
hub / github.com/Grover-c13/PokeGOAPI-Java / Log

Class Log

src/main/java/com/pokegoapi/util/Log.java:24–176  ·  view source on GitHub ↗

Created by Will on 7/20/16.

Source from the content-addressed store, hash-verified

22 * Created by Will on 7/20/16.
23 */
24@SuppressWarnings({ "checkstyle:methodname", "checkstyle:javadocmethod" })
25public class Log {
26
27 private static Logger logger;
28 private static Level level = Level.VERBOSE;
29
30 private static Logger getInstance() {
31 if (logger == null) {
32 logger = new DefaultLogger();
33 }
34 return logger;
35 }
36
37 // Do not call this while logging from a different thread...
38 // That's asking for trouble...
39 public static void setInstance(Logger logger) {
40 Log.logger = logger;
41 }
42
43 /**
44 * Sets the level of the Logger. For example, if the level is Error, all
45 * ERROR and ASSERT messages will be logged, but nothing else.
46 *
47 * @param level
48 * the level to log at
49 */
50 public static void setLevel(Level level) {
51 Log.level = level;
52 }
53
54 public static void v(String tag, String msg) {
55 if (level.level <= Level.VERBOSE.level) {
56 getInstance().v(tag, msg);
57 }
58 }
59
60 public static void v(String tag, String msg, Throwable tr) {
61 if (Log.level.level <= Level.VERBOSE.level) {
62 getInstance().v(tag, msg, tr);
63 }
64 }
65
66 public static void d(String tag, String msg) {
67 if (Log.level.level <= Level.DEBUG.level) {
68 getInstance().d(tag, msg);
69 }
70 }
71
72 public static void d(String tag, String msg, Throwable tr) {
73 if (Log.level.level <= Level.DEBUG.level) {
74 getInstance().d(tag, msg, tr);
75 }
76 }
77
78 public static void i(String tag, String msg) {
79 if (Log.level.level <= Level.INFO.level) {
80 getInstance().i(tag, msg);
81 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected