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

Method createMessage

lib/DevApp/src/main/java/dev/utils/JCLogUtils.java:109–132  ·  view source on GitHub ↗

处理信息 @param message 日志信息 @param args 占位符替换 @return 处理 ( 格式化 ) 后准备打印的日志信息

(
            final String message,
            final Object... args
    )

Source from the content-addressed store, hash-verified

107 * @return 处理 ( 格式化 ) 后准备打印的日志信息
108 */
109 private static String createMessage(
110 final String message,
111 final Object... args
112 ) {
113 String result;
114 try {
115 if (message != null) {
116 if (args == null) {
117 // 动态参数为 null
118 result = "params is null";
119 } else {
120 // 格式化字符串
121 result = (args.length == 0 ? message : String.format(message, args));
122 }
123 } else {
124 // 打印内容为 null
125 result = "message is null";
126 }
127 } catch (Exception e) {
128 // 出现异常
129 result = e.toString();
130 }
131 return result;
132 }
133
134 /**
135 * 拼接错误信息

Callers 4

concatErrorMessageMethod · 0.95
dTagMethod · 0.95
eTagMethod · 0.95
iTagMethod · 0.95

Calls 2

formatMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected