From: megacz Date: Fri, 30 Jan 2004 07:43:32 +0000 (+0000) Subject: 2003/12/29 03:25:45 X-Git-Tag: RC3~228 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e497cb520e0a5ef7de3db0f515af1822afb6a7a6;p=org.ibex.core.git 2003/12/29 03:25:45 darcs-hash:20040130074332-2ba56-2c543d04a9e9e195b0e2f626b6390f09863538a9.gz --- diff --git a/src/org/xwt/translators/Freetype.java b/src/org/xwt/translators/Freetype.java index d9c6904..3bff602 100644 --- a/src/org/xwt/translators/Freetype.java +++ b/src/org/xwt/translators/Freetype.java @@ -21,7 +21,7 @@ public class Freetype { public void loadFontByteStream(Res res) { try { - Log.log(this, "loading font " + res); + Log.info(this, "loading font " + res); loadedStream = res; InputStream is = res.getInputStream(); byte[] fontstream = InputStreamToByteArray.convert(is); @@ -34,7 +34,7 @@ public class Freetype { vm.execute(); if(vm.getState() == Runtime.DONE) throw new Error("Freetype VM exited: " + vm.exitStatus()); } catch (Exception e) { - Log.log(this, e); + Log.info(this, e); } } @@ -59,7 +59,7 @@ public class Freetype { vm.copyin(addr, glyph.data, glyph.width * glyph.height); } catch (Exception e) { - Log.log(this, e); + Log.info(this, e); } } } diff --git a/src/org/xwt/translators/GIF.java b/src/org/xwt/translators/GIF.java index d2cfed8..aa3f46a 100644 --- a/src/org/xwt/translators/GIF.java +++ b/src/org/xwt/translators/GIF.java @@ -65,7 +65,7 @@ public class GIF { try { g._load(is, p); } catch (Exception e) { - if (Log.on) Log.log(GIF.class, e); + if (Log.on) Log.info(GIF.class, e); return; } // FIXME: must reset fields diff --git a/src/org/xwt/translators/PNG.java b/src/org/xwt/translators/PNG.java index 6b7b11f..c20263f 100644 --- a/src/org/xwt/translators/PNG.java +++ b/src/org/xwt/translators/PNG.java @@ -35,7 +35,7 @@ public class PNG { g._load(is, p); p.data = g.data; } catch (Exception e) { - if (Log.on) Log.log(PNG.class, e); + if (Log.on) Log.info(PNG.class, e); return; } // FIXME: must reset fields @@ -59,7 +59,7 @@ public class PNG { // consume the header if ((inputStream.read() != 137) || (inputStream.read() != 80) || (inputStream.read() != 78) || (inputStream.read() != 71) || (inputStream.read() != 13) || (inputStream.read() != 10) || (inputStream.read() != 26) || (inputStream.read() != 10)) { - Log.log(this, "PNG: error: input file is not a PNG file"); + Log.info(this, "PNG: error: input file is not a PNG file"); data = p.data = new int[] { }; p.width = p.height = 0; return; @@ -166,7 +166,7 @@ public class PNG { private void handletRNS() throws IOException { int chunkLen = chunkLength; if (palette == null) { - if (Log.on) Log.log(this, "warning: tRNS chunk encountered before pLTE; ignoring alpha channel"); + if (Log.on) Log.info(this, "warning: tRNS chunk encountered before pLTE; ignoring alpha channel"); inputStream.skip(chunkLength); return; } diff --git a/src/org/xwt/translators/SVG.java b/src/org/xwt/translators/SVG.java index 8c22dd0..958d7a5 100644 --- a/src/org/xwt/translators/SVG.java +++ b/src/org/xwt/translators/SVG.java @@ -16,7 +16,7 @@ public class SVG { props.put("fill", h.get("fill")); props.put("stroke", h.get("stroke")); if ("visible".equals(h.get("overflow")) || "auto".equals(h.get("overflow"))) - Log.log(VectorGraphics.class, "warning: overflow={auto|visible} not supported; ignoring"); + Log.info(VectorGraphics.class, "warning: overflow={auto|visible} not supported; ignoring"); if (h.get("display") != null) props.put("invisible", new Boolean("none".equals(h.get("display")))); @@ -147,7 +147,7 @@ public class SVG { path = s + (name.equals("polygon") ? "z" : ""); } else { - Log.log(VectorGraphics.class, "unknown element in VectorGraphics namespace: " + name); + Log.info(VectorGraphics.class, "unknown element in VectorGraphics namespace: " + name); } props.put("path", path); t.keys = new String[props.size()]; diff --git a/src/org/xwt/util/CachedInputStream.java b/src/org/xwt/util/CachedInputStream.java index 2056a73..4e38954 100644 --- a/src/org/xwt/util/CachedInputStream.java +++ b/src/org/xwt/util/CachedInputStream.java @@ -55,8 +55,8 @@ public class CachedInputStream { cacheFileStream.close(); cacheFile.renameTo(diskCache); } catch (IOException e) { - Log.log(this, "exception thrown while writing disk cache"); - Log.log(this, e); + Log.info(this, "exception thrown while writing disk cache"); + Log.info(this, e); } } else size += ret; diff --git a/src/org/xwt/util/Log.java b/src/org/xwt/util/Log.java index 0554f25..aa24171 100644 --- a/src/org/xwt/util/Log.java +++ b/src/org/xwt/util/Log.java @@ -27,9 +27,11 @@ public class Log { public static void logJS(Object message) { log(JS.getSourceName() + ":" + JS.getLine(), message); } /** message can be a String or a Throwable */ - public static synchronized void log(Object o, Object message) { - log(o, message, INFO); - } + public static synchronized void echo(Object o, Object message) { log(o, message, ECHO); } + public static synchronized void debug(Object o, Object message) { log(o, message, DEBUG); } + public static synchronized void info(Object o, Object message) { log(o, message, INFO); } + public static synchronized void warn(Object o, Object message) { log(o, message, WARN); } + public static synchronized void error(Object o, Object message) { log(o, message, ERROR); } // these two logging levels serve ONLY to change the color; semantically they are the same as DEBUG private static final int DIAGNOSTIC = -2; diff --git a/src/org/xwt/util/Queue.java b/src/org/xwt/util/Queue.java index e2559e1..05a9073 100644 --- a/src/org/xwt/util/Queue.java +++ b/src/org/xwt/util/Queue.java @@ -76,8 +76,8 @@ public class Queue { wait(); } catch (InterruptedException e) { } catch (Exception e) { - if (Log.on) Log.log(this, "exception in Queue.wait(); this should never happen"); - if (Log.on) Log.log(this, e); + if (Log.on) Log.info(this, "exception in Queue.wait(); this should never happen"); + if (Log.on) Log.info(this, e); } } diff --git a/src/org/xwt/util/SSL.java b/src/org/xwt/util/SSL.java index c27bace..84fc575 100644 --- a/src/org/xwt/util/SSL.java +++ b/src/org/xwt/util/SSL.java @@ -108,7 +108,7 @@ public class SSL extends Socket { while(true) { String s2 = br.readLine(); if (s2 == null) return; - Log.log(SSL.class, s2); + Log.info(SSL.class, s2); } } catch (Exception e) { @@ -241,21 +241,21 @@ public class SSL extends Socket { byte type; try { type = raw.readByte(); } catch (EOFException e) { - if (Log.on) Log.log(this, "got EOFException reading packet type"); + if (Log.on) Log.info(this, "got EOFException reading packet type"); return null; } byte ver_major = raw.readByte(); byte ver_minor = raw.readByte(); short len = raw.readShort(); - if (Log.on) Log.log(this, "got record of type " + type + ", SSLv" + ver_major + "." + ver_minor + ", length=" + len); + if (Log.on) Log.info(this, "got record of type " + type + ", SSLv" + ver_major + "." + ver_minor + ", length=" + len); byte[] ret = new byte[len]; raw.readFully(ret); // simply ignore ChangeCipherSpec messages -- we change as soon as we send ours if (type == 20) { - if (Log.on) Log.log(this, "got ChangeCipherSpec; ignoring"); + if (Log.on) Log.info(this, "got ChangeCipherSpec; ignoring"); seq_num = 0; return readRecord(); } @@ -282,23 +282,23 @@ public class SSL extends Socket { if (decrypted_payload[1] > 1) { throw new SSLException("got SSL ALERT message, level=" + decrypted_payload[0] + " code=" + decrypted_payload[1]); } else if (decrypted_payload[1] == 0) { - if (Log.on) Log.log(this, "server requested connection closure; returning null"); + if (Log.on) Log.info(this, "server requested connection closure; returning null"); return null; } else { - if (Log.on) Log.log(this, "got SSL ALERT message, level=" + decrypted_payload[0] + " code=" + decrypted_payload[1]); + if (Log.on) Log.info(this, "got SSL ALERT message, level=" + decrypted_payload[0] + " code=" + decrypted_payload[1]); return readRecord(); } } else if (type == 22) { - if (Log.on) Log.log(this, "read a handshake"); + if (Log.on) Log.info(this, "read a handshake"); } else if (type != 23) { - if (Log.on) Log.log(this, "unexpected record type: " + type + "; skipping"); + if (Log.on) Log.info(this, "unexpected record type: " + type + "; skipping"); return readRecord(); } - if (Log.on) Log.log(this, " returning " + decrypted_payload.length + " byte record payload"); + if (Log.on) Log.info(this, " returning " + decrypted_payload.length + " byte record payload"); return decrypted_payload; } @@ -325,7 +325,7 @@ public class SSL extends Socket { switch(rec[0]) { case 2: // ServerHello - if (Log.on) Log.log(this, "got ServerHello"); + if (Log.on) Log.info(this, "got ServerHello"); byte ver_major = rec[4]; byte ver_minor = rec[5]; System.arraycopy(rec, 6, server_random, 0, server_random.length); @@ -334,11 +334,11 @@ public class SSL extends Socket { if (cipher_low == 0x04 || cipher_high != 0x00) { export = false; - if (Log.on) Log.log(this, "using SSL_RSA_WITH_RC4_128_MD5"); + if (Log.on) Log.info(this, "using SSL_RSA_WITH_RC4_128_MD5"); } else if (cipher_low == 0x03 || cipher_high != 0x00) { export = true; - if (Log.on) Log.log(this, "using SSL_RSA_EXPORT_WITH_RC4_40_MD5"); + if (Log.on) Log.info(this, "using SSL_RSA_EXPORT_WITH_RC4_40_MD5"); } else throw new SSLException("server asked for cipher " + ((cipher_high << 8) | cipher_low) + " but we only do SSL_RSA_WITH_RC4_128_MD5 (0x0004) and " + @@ -350,7 +350,7 @@ public class SSL extends Socket { break; case 11: // Server's certificate(s) - if (Log.on) Log.log(this, "got Server Certificate(s)"); + if (Log.on) Log.info(this, "got Server Certificate(s)"); int numcertbytes = ((rec[4] & 0xff) << 16) | ((rec[5] & 0xff) << 8) | (rec[6] & 0xff); int numcerts = 0; X509CertificateStructure last_cert = null; @@ -407,7 +407,7 @@ public class SSL extends Socket { if (!ignoreUntrustedCert && now.before(startDate)) throw new SSLException("server certificate will not be valid until " + startDate); - Log.log(this, "server cert (name, validity dates) checks out okay"); + Log.info(this, "server cert (name, validity dates) checks out okay"); } else { @@ -429,7 +429,7 @@ public class SSL extends Socket { i += certlen + 3; numcerts++; } - if (Log.on) Log.log(this, " Certificate (" + numcerts + " certificates)"); + if (Log.on) Log.info(this, " Certificate (" + numcerts + " certificates)"); if (ignoreUntrustedCert) break; @@ -439,7 +439,7 @@ public class SSL extends Socket { String subject = this_cert.getSubject().toString(); for(int i=0; i