1 | /* |
---|
2 | * This program is free software; you can redistribute it and/or modify |
---|
3 | * it under the terms of the GNU General Public License as published by |
---|
4 | * the Free Software Foundation; either version 2 of the License, or |
---|
5 | * (at your option) any later version. |
---|
6 | * |
---|
7 | * This program is distributed in the hope that it will be useful, |
---|
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | * GNU General Public License for more details. |
---|
11 | * |
---|
12 | * You should have received a copy of the GNU General Public License |
---|
13 | * along with this program; if not, write to the Free Software |
---|
14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * ConsoleLogger.java |
---|
19 | * Copyright (C) 2008 University of Waikato, Hamilton, New Zealand |
---|
20 | */ |
---|
21 | |
---|
22 | package weka.core.logging; |
---|
23 | |
---|
24 | import weka.core.RevisionUtils; |
---|
25 | |
---|
26 | import java.util.Date; |
---|
27 | |
---|
28 | /** |
---|
29 | * A simple logger that outputs the logging information in the console. |
---|
30 | * |
---|
31 | * @author fracpete (fracpete at waikato dot ac dot nz) |
---|
32 | * @version $Revision: 4716 $ |
---|
33 | */ |
---|
34 | public class ConsoleLogger |
---|
35 | extends Logger { |
---|
36 | |
---|
37 | /** |
---|
38 | * Performs the actual logging. |
---|
39 | * |
---|
40 | * @param level the level of the message |
---|
41 | * @param msg the message to log |
---|
42 | * @param cls the classname originating the log event |
---|
43 | * @param method the method originating the log event |
---|
44 | * @param lineno the line number originating the log event |
---|
45 | */ |
---|
46 | protected void doLog(Level level, String msg, String cls, String method, int lineno) { |
---|
47 | System.err.println( |
---|
48 | m_DateFormat.format(new Date()) + " " + cls + " " + method + "\n" |
---|
49 | + level + ": " + msg); |
---|
50 | } |
---|
51 | |
---|
52 | /** |
---|
53 | * Returns the revision string. |
---|
54 | * |
---|
55 | * @return the revision |
---|
56 | */ |
---|
57 | public String getRevision() { |
---|
58 | return RevisionUtils.extract("$Revision: 4716 $"); |
---|
59 | } |
---|
60 | } |
---|