| Method from org.apache.bsf.debug.util.DebugLog Detail: |
public static void debugPrint(Object obj,
int prio) {
streamPrint(obj, debugStream, prio);
}
|
public static void debugPrintln(Object obj,
int prio) {
streamPrintln(obj, debugStream, prio);
}
|
public static PrintStream getDebugStream() {
return debugStream;
}
|
public static int getLogLevel() {
return loglevel;
}
|
public static void setDebugStream(PrintStream dbgStream) {
debugStream = dbgStream;
}
|
public static void setLogLevel(int loglvl) {
if (loglvl != loglevel) {
if (loglvl >= 0) {
try {
final int loglvlf = loglvl;
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws Exception {
System.setProperty("org.apache.bsf.debug.logLevel", String.valueOf(loglvlf));
return null;
}
});
loglevel = loglvlf;
}
catch (PrivilegedActionException prive) {
Exception e = prive.getException();
System.err.println("Unable to set loglevel: "
+ e.getMessage());
e.printStackTrace();
}
}
}
}
|
public static void stderrPrint(Object obj,
int prio) {
streamPrint(obj, System.err, prio);
}
|
public static void stderrPrintln(Object obj,
int prio) {
streamPrintln(obj, System.err, prio);
}
|
public static void stdoutPrint(Object obj,
int prio) {
Integer logprop = Integer.getInteger("org.apache.bsf.debug.logLevel", 0);
setLogLevel(logprop.intValue());
logLevels = new Hashtable();
logLevels.put("BSF_LOG_L0", new Integer(BSF_LOG_L0));
logLevels.put("BSF_LOG_L1", new Integer(BSF_LOG_L1));
logLevels.put("BSF_LOG_L2", new Integer(BSF_LOG_L2));
logLevels.put("BSF_LOG_L3", new Integer(BSF_LOG_L3));
streamPrint(obj, System.out, prio);
}
|
public static void stdoutPrintln(Object obj,
int prio) {
streamPrintln(obj, System.out, prio);
}
|
public static void streamPrint(Object obj,
OutputStream ostrm,
int prio) {
if (loglevel >= prio) {
PrintStream prs =
(ostrm instanceof PrintStream) ? (PrintStream) ostrm
: new PrintStream (ostrm, true);
prs.print(obj);
}
}
|
public static void streamPrintln(Object obj,
OutputStream ostrm,
int prio) {
if (loglevel >= prio) {
PrintStream prs =
(ostrm instanceof PrintStream) ? (PrintStream) ostrm
: new PrintStream (ostrm, true);
prs.println(obj);
}
}
|