19 package org.openoffice.xmerge.util;
21 import java.io.BufferedWriter;
22 import java.io.IOException;
23 import java.io.FileWriter;
24 import java.io.InputStream;
25 import java.io.OutputStream;
26 import java.io.OutputStreamWriter;
27 import java.io.PrintWriter;
28 import java.io.Writer;
29 import java.util.Properties;
42 public static final int INFO = 0x0001;
44 public static final int ERROR = 0x0002;
46 public static final int TRACE = 0x0004;
49 private static final boolean SET =
true;
52 private static PrintWriter
writer = null;
56 InputStream is = null;
59 is =
Debug.class.getResourceAsStream(
"Debug.properties");
63 String info = props.getProperty(
"debug.info",
"false");
64 info = info.toLowerCase();
66 if (info.equals(
"true")) {
70 String trace = props.getProperty(
"debug.trace",
"false");
71 trace = trace.toLowerCase();
73 if (trace.equals(
"true")) {
77 String error = props.getProperty(
"debug.error",
"false");
78 error = error.toLowerCase();
80 if (error.equals(
"true")) {
84 String w = props.getProperty(
"debug.output",
"System.out");
91 }
catch (Throwable
ex) {
92 ex.printStackTrace(
System.err);
113 if (writer == null) {
114 if (str.equals(
"System.out")) {
116 }
else if (str.equals(
"System.err")) {
121 }
catch (IOException e) {
122 e.printStackTrace(
System.err);
134 setOutput(
new OutputStreamWriter(stream));
143 if (writer != null) {
146 writer =
new PrintWriter(
new BufferedWriter(w),
true);
177 return ((flags & f) != 0);
205 public static void log(
int flag, String msg) {
223 public static void log(
int flag, String msg, Throwable e) {
227 e.printStackTrace(writer);
static final int INFO
Informational messages.
static void log(int flag, String msg, Throwable e)
Log message based on flag type plus print out stack trace of the exception passed in...
static void log(int flag, String msg)
Log message based on the flag type.
static void setOutput(OutputStream stream)
Set the output to an.
static final int TRACE
Trace messages.
static final int ERROR
Error messages.
Debug()
Private constructor so as not to allow any instances of this class.
exports com.sun.star. java
static void setFlags(int f, boolean set)
This method sets the levels for debugging logs.
static void setOutput(Writer w)
Set the.
static boolean isFlagSet(int f)
Checks if flag is set.
static final boolean SET
To set a flag.
static void setOutput(String str)
Set the output to the specified argument.
This class is used for logging debug messages.
static PrintWriter writer