STPServiceLogger.java
5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.fd.stp.internal.logging;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class STPServiceLogger {
ResourceBundle bundle;
Logger logger;
private static String LOGGING_BUNDLE = "com.adobe.fd.stp.internal.logging.STPService";
public STPServiceLogger(Class clazz) {
this.logger = LoggerFactory.getLogger((Class)clazz);
this.bundle = ResourceBundle.getBundle(this.getLoggingBundle());
}
protected String getLoggingBundle() {
return LOGGING_BUNDLE;
}
public String formatMsg(String format, Object[] args) {
StringBuffer sb = new StringBuffer();
if (format != null) {
StringTokenizer st = new StringTokenizer(format, "{}");
boolean counter = false;
int argPos = format.indexOf("{}");
int index = 0;
if (args != null && argPos > -1) {
sb.append(format.substring(0, argPos));
while (argPos < format.length() && argPos >= 0 && index < args.length) {
sb.append(args[index++]);
int argPos2 = format.indexOf("{}", argPos + 1);
sb.append(format.substring(argPos + 2, argPos2 > -1 ? argPos2 : format.length()));
argPos = argPos2;
}
}
}
return sb.toString();
}
public String msgToLog(String msg) {
try {
if (this.bundle != null && this.bundle.getObject(msg) != null) {
return msg + ":" + (String)this.bundle.getObject(msg);
}
}
catch (Exception e) {
this.logger.trace("Exception while reading resource " + msg + " from " + this.getLoggingBundle(), (Throwable)e);
}
return msg;
}
public void warn(String msg) {
msg = this.msgToLog(msg);
this.logger.warn(msg);
}
public void warn(String msg, String arg1) {
msg = this.msgToLog(msg);
this.logger.warn(msg, (Object)arg1);
}
public void warn(String msg, String arg1, String arg2) {
msg = this.msgToLog(msg);
this.logger.warn(msg, (Object)arg1, (Object)arg2);
}
public void warn(String msg, Object[] args) {
msg = this.msgToLog(msg);
this.logger.warn(msg, args);
}
public void warn(String msg, Object[] args, Throwable t) {
msg = this.formatMsg(this.msgToLog(msg), args);
this.logger.warn(msg, t);
}
public void error(String msg) {
msg = this.msgToLog(msg);
this.logger.error(msg);
}
public void error(String msg, String arg1) {
msg = this.msgToLog(msg);
this.logger.error(msg, (Object)arg1);
}
public void error(String msg, String arg1, String arg2) {
msg = this.msgToLog(msg);
this.logger.error(msg, (Object)arg1, (Object)arg2);
}
public void error(String msg, Object[] args) {
msg = this.msgToLog(msg);
this.logger.error(msg, args);
}
public void error(String msg, Object[] args, Throwable t) {
msg = this.formatMsg(this.msgToLog(msg), args);
this.logger.error(msg, t);
}
public void debug(String msg) {
msg = this.msgToLog(msg);
this.logger.debug(msg);
}
public void debug(String msg, String arg1) {
msg = this.msgToLog(msg);
this.logger.debug(msg, (Object)arg1);
}
public void debug(String msg, String arg1, String arg2) {
msg = this.msgToLog(msg);
this.logger.debug(msg, (Object)arg1, (Object)arg2);
}
public void debug(String msg, Object[] args) {
msg = this.msgToLog(msg);
this.logger.debug(msg, args);
}
public void debug(String msg, Object[] args, Throwable t) {
msg = this.formatMsg(this.msgToLog(msg), args);
this.logger.debug(msg, t);
}
public void info(String msg) {
msg = this.msgToLog(msg);
this.logger.info(msg);
}
public void info(String msg, String arg1) {
msg = this.msgToLog(msg);
this.logger.info(msg, (Object)arg1);
}
public void info(String msg, String arg1, String arg2) {
msg = this.msgToLog(msg);
this.logger.info(msg, (Object)arg1, (Object)arg2);
}
public void info(String msg, Object[] args) {
msg = this.msgToLog(msg);
this.logger.info(msg, args);
}
public void info(String msg, Object[] args, Throwable t) {
msg = this.formatMsg(this.msgToLog(msg), args);
this.logger.info(msg, t);
}
public void trace(String msg) {
msg = this.msgToLog(msg);
this.logger.trace(msg);
}
public void trace(String msg, String arg1) {
msg = this.msgToLog(msg);
this.logger.trace(msg, (Object)arg1);
}
public void trace(String msg, String arg1, String arg2) {
msg = this.msgToLog(msg);
this.logger.trace(msg, (Object)arg1, (Object)arg2);
}
public void trace(String msg, Object[] args) {
msg = this.msgToLog(msg);
this.logger.trace(msg, args);
}
public void trace(String msg, Object[] args, Throwable t) {
msg = this.formatMsg(this.msgToLog(msg), args);
this.logger.trace(msg, t);
}
}