0f850e99a915189c61a914ab32d91500ae06c041
[jalviewjs.git] / site / swingjs / j2s / java / util / logging / Logger.js
1 Clazz.declarePackage ("java.util.logging");
2 Clazz.load (["java.util.Hashtable", "java.util.logging.Level", "$.LogRecord"], "java.util.logging.Logger", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.name = null;
5 this.levelObject = null;
6 this.levelValue = 0;
7 Clazz.instantialize (this, arguments);
8 }, java.util.logging, "Logger");
9 Clazz.makeConstructor (c$, 
10 function (name, resourceBundleName) {
11 this.construct (name, resourceBundleName, null, false);
12 }, "~S,~S");
13 Clazz.makeConstructor (c$, 
14 function (name, resourceBundleName, caller, isSystemLogger) {
15 this.name = name;
16 this.levelValue = java.util.logging.Level.INFO.intValue ();
17 }, "~S,~S,Class,~B");
18 Clazz.makeConstructor (c$, 
19  function (name) {
20 this.name = name;
21 this.levelValue = java.util.logging.Level.INFO.intValue ();
22 }, "~S");
23 c$.getLogger = Clazz.defineMethod (c$, "getLogger", 
24 function (name) {
25 var log = java.util.logging.Logger.loggers.get (name);
26 if (log == null) java.util.logging.Logger.loggers.put (name, log =  new java.util.logging.Logger (name));
27 return log;
28 }, "~S");
29 c$.getLogger = Clazz.defineMethod (c$, "getLogger", 
30 function (name, resourceBundleName) {
31 return java.util.logging.Logger.getLogger (name);
32 }, "~S,~S");
33 c$.getAnonymousLogger = Clazz.defineMethod (c$, "getAnonymousLogger", 
34 function () {
35 return java.util.logging.Logger.getAnonymousLogger (null);
36 });
37 c$.getAnonymousLogger = Clazz.defineMethod (c$, "getAnonymousLogger", 
38 function (resourceBundleName) {
39 return java.util.logging.Logger.global;
40 }, "~S");
41 Clazz.defineMethod (c$, "log", 
42 function (record) {
43 if (record.getLevel ().intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
44 return;
45 }System.out.println (record.getLoggerName () + ": " + record.getMessage ());
46 }, "java.util.logging.LogRecord");
47 Clazz.defineMethod (c$, "doLog", 
48  function (lr) {
49 lr.setLoggerName (this.name);
50 this.log (lr);
51 }, "java.util.logging.LogRecord");
52 Clazz.defineMethod (c$, "log", 
53 function (level, msg) {
54 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
55 return;
56 }var lr =  new java.util.logging.LogRecord (level, msg);
57 this.doLog (lr);
58 }, "java.util.logging.Level,~S");
59 Clazz.defineMethod (c$, "log", 
60 function (level, msg, param1) {
61 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
62 return;
63 }var lr =  new java.util.logging.LogRecord (level, msg);
64 var params =  Clazz.newArray (-1, [param1]);
65 lr.setParameters (params);
66 this.doLog (lr);
67 }, "java.util.logging.Level,~S,~O");
68 Clazz.defineMethod (c$, "log", 
69 function (level, msg, params) {
70 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
71 return;
72 }var lr =  new java.util.logging.LogRecord (level, msg);
73 lr.setParameters (params);
74 this.doLog (lr);
75 }, "java.util.logging.Level,~S,~A");
76 Clazz.defineMethod (c$, "log", 
77 function (level, msg, thrown) {
78 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
79 return;
80 }var lr =  new java.util.logging.LogRecord (level, msg);
81 lr.setThrown (thrown);
82 this.doLog (lr);
83 }, "java.util.logging.Level,~S,Throwable");
84 Clazz.defineMethod (c$, "logp", 
85 function (level, sourceClass, sourceMethod, msg) {
86 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
87 return;
88 }var lr =  new java.util.logging.LogRecord (level, msg);
89 lr.setSourceClassName (sourceClass);
90 lr.setSourceMethodName (sourceMethod);
91 this.doLog (lr);
92 }, "java.util.logging.Level,~S,~S,~S");
93 Clazz.defineMethod (c$, "logp", 
94 function (level, sourceClass, sourceMethod, msg, param1) {
95 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
96 return;
97 }var lr =  new java.util.logging.LogRecord (level, msg);
98 lr.setSourceClassName (sourceClass);
99 lr.setSourceMethodName (sourceMethod);
100 var params =  Clazz.newArray (-1, [param1]);
101 lr.setParameters (params);
102 this.doLog (lr);
103 }, "java.util.logging.Level,~S,~S,~S,~O");
104 Clazz.defineMethod (c$, "logp", 
105 function (level, sourceClass, sourceMethod, msg, params) {
106 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
107 return;
108 }var lr =  new java.util.logging.LogRecord (level, msg);
109 lr.setSourceClassName (sourceClass);
110 lr.setSourceMethodName (sourceMethod);
111 lr.setParameters (params);
112 this.doLog (lr);
113 }, "java.util.logging.Level,~S,~S,~S,~A");
114 Clazz.defineMethod (c$, "logp", 
115 function (level, sourceClass, sourceMethod, msg, thrown) {
116 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
117 return;
118 }var lr =  new java.util.logging.LogRecord (level, msg);
119 lr.setSourceClassName (sourceClass);
120 lr.setSourceMethodName (sourceMethod);
121 lr.setThrown (thrown);
122 this.doLog (lr);
123 }, "java.util.logging.Level,~S,~S,~S,Throwable");
124 Clazz.defineMethod (c$, "entering", 
125 function (sourceClass, sourceMethod) {
126 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
127 return;
128 }this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "ENTRY");
129 }, "~S,~S");
130 Clazz.defineMethod (c$, "entering", 
131 function (sourceClass, sourceMethod, param1) {
132 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
133 return;
134 }var params =  Clazz.newArray (-1, [param1]);
135 this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "ENTRY {0}", params);
136 }, "~S,~S,~O");
137 Clazz.defineMethod (c$, "entering", 
138 function (sourceClass, sourceMethod, params) {
139 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
140 return;
141 }var msg = "ENTRY";
142 if (params == null) {
143 this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, msg);
144 return;
145 }for (var i = 0; i < params.length; i++) {
146 msg = msg + " {" + i + "}";
147 }
148 this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, msg, params);
149 }, "~S,~S,~A");
150 Clazz.defineMethod (c$, "exiting", 
151 function (sourceClass, sourceMethod) {
152 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
153 return;
154 }this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "RETURN");
155 }, "~S,~S");
156 Clazz.defineMethod (c$, "exiting", 
157 function (sourceClass, sourceMethod, result) {
158 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
159 return;
160 }this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
161 }, "~S,~S,~O");
162 Clazz.defineMethod (c$, "throwing", 
163 function (sourceClass, sourceMethod, thrown) {
164 if (java.util.logging.Level.FINER.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
165 return;
166 }var lr =  new java.util.logging.LogRecord (java.util.logging.Level.FINER, "THROW");
167 lr.setSourceClassName (sourceClass);
168 lr.setSourceMethodName (sourceMethod);
169 lr.setThrown (thrown);
170 this.doLog (lr);
171 }, "~S,~S,Throwable");
172 Clazz.defineMethod (c$, "severe", 
173 function (msg) {
174 if (java.util.logging.Level.SEVERE.intValue () < this.levelValue) {
175 return;
176 }this.log (java.util.logging.Level.SEVERE, msg);
177 }, "~S");
178 Clazz.defineMethod (c$, "warning", 
179 function (msg) {
180 if (java.util.logging.Level.WARNING.intValue () < this.levelValue) {
181 return;
182 }this.log (java.util.logging.Level.WARNING, msg);
183 }, "~S");
184 Clazz.defineMethod (c$, "info", 
185 function (msg) {
186 if (java.util.logging.Level.INFO.intValue () < this.levelValue) {
187 return;
188 }this.log (java.util.logging.Level.INFO, msg);
189 }, "~S");
190 Clazz.defineMethod (c$, "config", 
191 function (msg) {
192 if (java.util.logging.Level.CONFIG.intValue () < this.levelValue) {
193 return;
194 }this.log (java.util.logging.Level.CONFIG, msg);
195 }, "~S");
196 Clazz.defineMethod (c$, "fine", 
197 function (msg) {
198 if (java.util.logging.Level.FINE.intValue () < this.levelValue) {
199 return;
200 }this.log (java.util.logging.Level.FINE, msg);
201 }, "~S");
202 Clazz.defineMethod (c$, "finer", 
203 function (msg) {
204 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
205 return;
206 }this.log (java.util.logging.Level.FINER, msg);
207 }, "~S");
208 Clazz.defineMethod (c$, "finest", 
209 function (msg) {
210 if (java.util.logging.Level.FINEST.intValue () < this.levelValue) {
211 return;
212 }this.log (java.util.logging.Level.FINEST, msg);
213 }, "~S");
214 Clazz.defineMethod (c$, "setLevel", 
215 function (newLevel) {
216 this.levelObject = newLevel;
217 this.updateEffectiveLevel ();
218 }, "java.util.logging.Level");
219 Clazz.defineMethod (c$, "getLevel", 
220 function () {
221 return this.levelObject;
222 });
223 Clazz.defineMethod (c$, "isLoggable", 
224 function (level) {
225 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
226 return false;
227 }return true;
228 }, "java.util.logging.Level");
229 Clazz.defineMethod (c$, "getName", 
230 function () {
231 return this.name;
232 });
233 Clazz.defineMethod (c$, "updateEffectiveLevel", 
234  function () {
235 var newLevelValue;
236 if (this.levelObject != null) {
237 newLevelValue = this.levelObject.intValue ();
238 } else {
239 newLevelValue = java.util.logging.Level.INFO.intValue ();
240 }if (this.levelValue == newLevelValue) {
241 return;
242 }this.levelValue = newLevelValue;
243 });
244 c$.offValue = c$.prototype.offValue = java.util.logging.Level.OFF.intValue ();
245 Clazz.defineStatics (c$,
246 "GLOBAL_LOGGER_NAME", "global");
247 c$.global = c$.prototype.global =  new java.util.logging.Logger ("global");
248 c$.loggers = c$.prototype.loggers =  new java.util.Hashtable ();
249 {
250 java.util.logging.Logger.loggers.put ("global", java.util.logging.Logger.global);
251 }});