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 () {
5 this.levelObject = null;
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);
13 Clazz.makeConstructor (c$,
14 function (name, resourceBundleName, caller, isSystemLogger) {
16 this.levelValue = java.util.logging.Level.INFO.intValue ();
18 Clazz.makeConstructor (c$,
21 this.levelValue = java.util.logging.Level.INFO.intValue ();
23 c$.getLogger = Clazz.defineMethod (c$, "getLogger",
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));
29 c$.getLogger = Clazz.defineMethod (c$, "getLogger",
30 function (name, resourceBundleName) {
31 return java.util.logging.Logger.getLogger (name);
33 c$.getAnonymousLogger = Clazz.defineMethod (c$, "getAnonymousLogger",
35 return java.util.logging.Logger.getAnonymousLogger (null);
37 c$.getAnonymousLogger = Clazz.defineMethod (c$, "getAnonymousLogger",
38 function (resourceBundleName) {
39 return java.util.logging.Logger.global;
41 Clazz.defineMethod (c$, "log",
43 if (record.getLevel ().intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
45 }System.out.println (record.getLoggerName () + ": " + record.getMessage ());
46 }, "java.util.logging.LogRecord");
47 Clazz.defineMethod (c$, "doLog",
49 lr.setLoggerName (this.name);
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) {
56 }var lr = new java.util.logging.LogRecord (level, msg);
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) {
63 }var lr = new java.util.logging.LogRecord (level, msg);
64 var params = Clazz.newArray (-1, [param1]);
65 lr.setParameters (params);
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) {
72 }var lr = new java.util.logging.LogRecord (level, msg);
73 lr.setParameters (params);
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) {
80 }var lr = new java.util.logging.LogRecord (level, msg);
81 lr.setThrown (thrown);
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) {
88 }var lr = new java.util.logging.LogRecord (level, msg);
89 lr.setSourceClassName (sourceClass);
90 lr.setSourceMethodName (sourceMethod);
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) {
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);
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) {
108 }var lr = new java.util.logging.LogRecord (level, msg);
109 lr.setSourceClassName (sourceClass);
110 lr.setSourceMethodName (sourceMethod);
111 lr.setParameters (params);
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) {
118 }var lr = new java.util.logging.LogRecord (level, msg);
119 lr.setSourceClassName (sourceClass);
120 lr.setSourceMethodName (sourceMethod);
121 lr.setThrown (thrown);
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) {
128 }this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "ENTRY");
130 Clazz.defineMethod (c$, "entering",
131 function (sourceClass, sourceMethod, param1) {
132 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
134 }var params = Clazz.newArray (-1, [param1]);
135 this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "ENTRY {0}", params);
137 Clazz.defineMethod (c$, "entering",
138 function (sourceClass, sourceMethod, params) {
139 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
142 if (params == null) {
143 this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, msg);
145 }for (var i = 0; i < params.length; i++) {
146 msg = msg + " {" + i + "}";
148 this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, msg, params);
150 Clazz.defineMethod (c$, "exiting",
151 function (sourceClass, sourceMethod) {
152 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
154 }this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "RETURN");
156 Clazz.defineMethod (c$, "exiting",
157 function (sourceClass, sourceMethod, result) {
158 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
160 }this.logp (java.util.logging.Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
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) {
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);
171 }, "~S,~S,Throwable");
172 Clazz.defineMethod (c$, "severe",
174 if (java.util.logging.Level.SEVERE.intValue () < this.levelValue) {
176 }this.log (java.util.logging.Level.SEVERE, msg);
178 Clazz.defineMethod (c$, "warning",
180 if (java.util.logging.Level.WARNING.intValue () < this.levelValue) {
182 }this.log (java.util.logging.Level.WARNING, msg);
184 Clazz.defineMethod (c$, "info",
186 if (java.util.logging.Level.INFO.intValue () < this.levelValue) {
188 }this.log (java.util.logging.Level.INFO, msg);
190 Clazz.defineMethod (c$, "config",
192 if (java.util.logging.Level.CONFIG.intValue () < this.levelValue) {
194 }this.log (java.util.logging.Level.CONFIG, msg);
196 Clazz.defineMethod (c$, "fine",
198 if (java.util.logging.Level.FINE.intValue () < this.levelValue) {
200 }this.log (java.util.logging.Level.FINE, msg);
202 Clazz.defineMethod (c$, "finer",
204 if (java.util.logging.Level.FINER.intValue () < this.levelValue) {
206 }this.log (java.util.logging.Level.FINER, msg);
208 Clazz.defineMethod (c$, "finest",
210 if (java.util.logging.Level.FINEST.intValue () < this.levelValue) {
212 }this.log (java.util.logging.Level.FINEST, msg);
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",
221 return this.levelObject;
223 Clazz.defineMethod (c$, "isLoggable",
225 if (level.intValue () < this.levelValue || this.levelValue == java.util.logging.Logger.offValue) {
228 }, "java.util.logging.Level");
229 Clazz.defineMethod (c$, "getName",
233 Clazz.defineMethod (c$, "updateEffectiveLevel",
236 if (this.levelObject != null) {
237 newLevelValue = this.levelObject.intValue ();
239 newLevelValue = java.util.logging.Level.INFO.intValue ();
240 }if (this.levelValue == newLevelValue) {
242 }this.levelValue = newLevelValue;
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 ();
250 java.util.logging.Logger.loggers.put ("global", java.util.logging.Logger.global);