MCPcopy Create free account
hub / github.com/afkT/DevUtils / JCLogUtils

Class JCLogUtils

lib/DevJava/src/main/java/dev/utils/JCLogUtils.java:20–395  ·  view source on GitHub ↗

detail: Java Common 日志打印工具类 ( 简化版 ) @author Ttt 项目内部使用 ( 主要打印 Java 日志 )

Source from the content-addressed store, hash-verified

18 * </pre>
19 */
20public final class JCLogUtils {
21
22 private JCLogUtils() {
23 }
24
25 // 是否打印日志 线上 (release) = false, 开发 (debug) = true
26 private static boolean JUDGE_PRINT_LOG = false;
27 // 判断是否控制台打印信息
28 private static boolean JUDGE_CONTROL_PRINT_LOG = false;
29 // 默认 DEFAULT_TAG
30 private static final String DEFAULT_TAG = JCLogUtils.class.getSimpleName();
31
32 // ==========
33 // = 日志类型 =
34 // ==========
35
36 // INFO 模式
37 public static final int INFO = 0;
38 // DEBUG 模式
39 public static final int DEBUG = 1;
40 // ERROR 模式
41 public static final int ERROR = 2;
42
43 /**
44 * 判断是否打印日志
45 * @return {@code true} yes, {@code false} no
46 */
47 public static boolean isPrintLog() {
48 return JUDGE_PRINT_LOG;
49 }
50
51 /**
52 * 设置是否打印日志
53 * @param judgePrintLog 是否允许打印日志
54 */
55 public static void setPrintLog(final boolean judgePrintLog) {
56 JUDGE_PRINT_LOG = judgePrintLog;
57 }
58
59 /**
60 * 设置是否在控制台打印日志
61 * @param judgeControlPrintLog 是否允许控制台打印日志
62 */
63 public static void setControlPrintLog(final boolean judgeControlPrintLog) {
64 JUDGE_CONTROL_PRINT_LOG = judgeControlPrintLog;
65 }
66
67 /**
68 * 判断字符串是否为 null
69 * @param str 待校验的字符串
70 * @return {@code true} yes, {@code false} no
71 */
72 private static boolean isEmpty(final String str) {
73 return (str == null || str.length() == 0);
74 }
75
76 // =
77

Callers

nothing calls this directly

Calls 1

getSimpleNameMethod · 0.80

Tested by

no test coverage detected