01: package com.sun.portal.proxylet.client.common;
02:
03: import com.sun.portal.proxylet.client.common.ui.ProxyletUI;
04:
05: /**
06: * Log class
07: *
08: * Logs messages to Proxylet UI console as well as Java Console.
09: *
10: * Java Console logging level is determiend by the 'DEBUG' flag on JNLP file
11: * and applet template file. 'DEBUG'- 0 logs info messages , 1- logs debug message.
12: *
13: * Proxylet UI console logging level can be altered by checking the 'Extra logging' checkbox on the UI.
14: * If the checkbox is enabled, logs debug message
15: *
16: * Info message contains adequate information for user to use proxylet.
17: * Debug messages contains all other messages and also exceptions.
18: *
19: * Error conditions are logged to both console as well as UI.
20: *
21: */
22: public class Log {
23: private static boolean debugLevelConsole = false;
24: private static boolean debugLevelUI = false;
25:
26: public static synchronized void setloglevel_UI(boolean level) {
27: debugLevelUI = level;
28: }
29:
30: public static synchronized void setloglevel_JavaConsole(
31: boolean level) {
32: debugLevelConsole = level;
33: }
34:
35: /* Displays text on UI and java console
36: */
37: public static void info(String msg) {
38: System.out.println(msg);
39: ProxyletUI.setText(msg);
40: }
41:
42: public static void debug(String msg) {
43: if (debugLevelConsole)
44: System.out.println(msg);
45: }
46:
47: public static void debugu(String msg) {
48: if (debugLevelUI)
49: ProxyletUI.setText(msg);
50: if (debugLevelConsole)
51: System.out.println(msg);
52: }
53:
54: }
|