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.11
Committed: Sun Aug 1 10:40:56 2004 UTC (19 years, 9 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +3 -3 lines
Log Message:
Catch a lot of old URL's and update them. Also remove a couple of old files
that aren't used.

File Contents

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