Initial import.
2 * StarOffice News Server
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 import java.io.FileOutputStream;
22 import java.io.IOException;
23 import java.io.PrintStream;
24 import java.util.Date;
27 * Provides logging and debugging methods.
28 * @author Christian Lins
32 private static Debug instance = null;
35 * Returns the singelton instance of this class.
37 public static Debug getInstance()
40 instance = new Debug();
45 private PrintStream out = System.err;
48 * This class is a singelton class. The constructor is private to prevent
49 * the creation of more than one instance.
55 String filename = Config.getInstance().get(Config.CONFIG_N3TPD_LOGFILE, "n3tpd.log");
57 this.out = new PrintStream(new FileOutputStream(filename));
66 * Returns the debug output PrintStream. By default this is System.err.
68 public PrintStream getStream()
74 * Writes the given message to the debug output.
75 * @param msg A String message or an object.
77 public void log(Object msg)
84 * Writes the given debug message to the given PrintStream.
88 public void log(PrintStream out, Object msg)
90 out.print(new Date().toString());
92 out.println(msg.toString());