ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/core/loggers/ScreenLogger.java
Revision: 1.8
Committed: Sat May 18 18:16:01 2002 UTC (22 years ago) by tdb
Branch: MAIN
Changes since 1.7: +22 -3 lines
Log Message:
i-scream is now licensed under the GPL. I've added the GPL headers to every
source file, and put a full copy of the license in the appropriate places.
I think I've covered everything. This is going to be a mad commit ;)

File Contents

# Content
1 /*
2 * i-scream central monitoring system
3 * Copyright (C) 2000-2002 i-scream
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 //---PACKAGE DECLARATION---
21 package uk.org.iscream.cms.server.core.loggers;
22
23 //---IMPORTS---
24 import uk.org.iscream.cms.server.util.*;
25 import uk.org.iscream.cms.server.core.*;
26 import java.util.Date;
27 import java.text.DateFormat;
28 import java.util.Locale;
29
30 /**
31 * The ScreenLogger is an implementation of the LoggerImpl defined
32 * in the associated interface. It's only purpose is to simply print
33 * all the logging information it receives to the screen.
34 *
35 * @author $Author: tdb $
36 * @version $Id: ScreenLogger.java,v 1.7 2001/05/29 17:02:35 tdb Exp $
37 */
38 public class ScreenLogger implements LoggerImpl {
39
40 //---FINAL ATTRIBUTES---
41
42 /**
43 * The current CVS revision of this class
44 */
45 public final String REVISION = "$Revision: 1.7 $";
46
47 //---STATIC METHODS---
48
49 //---CONSTRUCTORS---
50
51 /**
52 * Creates a new ScreenLoggerServant.
53 */
54 public ScreenLogger() {
55 write(toString(), Logger.SYSINIT, "started");
56 }
57
58 //---PUBLIC METHODS---
59
60 /**
61 * The write() method takes a line of text, pre-formatted
62 * and outputs it using a method defined by the actual
63 * implementation. The verbosity is given in case the
64 * implementation wishes to utilise it in the layout -
65 * eg. a different colour or font.
66 *
67 * This instance simply prints the message to the screen.
68 *
69 * @param line A line of formatted text to be logged
70 * @param verbosity the verbosity of this message
71 */
72 public synchronized void write(String line, int verbosity) {;
73 System.out.println(line);
74 }
75
76 /**
77 * Overrides the {@link java.lang.Object#toString() Object.toString()}
78 * method to provide clean logging (every class should have this).
79 *
80 * This uses the uk.org.iscream.cms.server.util.FormatName class
81 * to format the toString()
82 *
83 * @return the name of this class and its CVS revision
84 */
85 public String toString() {
86 return FormatName.getName(
87 _name,
88 getClass().getName(),
89 REVISION);
90 }
91
92 //---PRIVATE METHODS---
93
94 /**
95 * This method is provided if this class wishes to log
96 * a message itself.
97 *
98 * @param source A String representation of the source
99 * @param verbosity the verbosity of this message
100 * @param message The message to log
101 */
102 private void write(String source, int verbosity, String message) {
103 write(FormatName.formatLogLine(source, verbosity, message), verbosity);
104 }
105
106 //---ACCESSOR/MUTATOR METHODS---
107
108 //---ATTRIBUTES---
109
110 /**
111 * This is the friendly identifier of the
112 * component this class is running in.
113 * eg, a Filter may be called "filter1",
114 * If this class does not have an owning
115 * component, a name from the configuration
116 * can be placed here. This name could also
117 * be changed to null for utility classes.
118 */
119 private String _name = Core.NAME;
120
121 //---STATIC ATTRIBUTES---
122
123 }