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.6
Committed: Wed Mar 14 23:25:29 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.5: +6 -6 lines
Log Message:
The whole server package structure has been changed.
Old Package: uk.ac.ukc.iscream.*
New Package: uk.org.iscream.*

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2 tdb 1.6 package uk.org.iscream.core.loggers;
3 tdb 1.1
4     //---IMPORTS---
5 tdb 1.6 import uk.org.iscream.util.*;
6     import uk.org.iscream.core.*;
7 tdb 1.1 import java.util.Date;
8     import java.text.DateFormat;
9     import java.util.Locale;
10    
11     /**
12     * The ScreenLogger is an implementation of the LoggerImpl defined
13     * in the associated interface. It's only purpose is to simply print
14     * all the logging information it receives to the screen.
15     *
16 tdb 1.5 * @author $Author: tdb1 $
17 tdb 1.6 * @version $Id: ScreenLogger.java,v 1.5 2001/02/25 20:49:20 tdb1 Exp $
18 tdb 1.1 */
19 ajm 1.2 public class ScreenLogger implements LoggerImpl {
20 tdb 1.1
21     //---FINAL ATTRIBUTES---
22    
23     /**
24     * The current CVS revision of this class
25     */
26 tdb 1.6 public final String REVISION = "$Revision: 1.5 $";
27 tdb 1.1
28     //---STATIC METHODS---
29    
30     //---CONSTRUCTORS---
31    
32     /**
33     * Creates a new ScreenLoggerServant.
34     */
35     public ScreenLogger() {
36 ajm 1.3 write(toString(), Logger.SYSINIT, "started");
37 tdb 1.1 }
38    
39     //---PUBLIC METHODS---
40    
41     /**
42 tdb 1.5 * The write() method takes a line of text, pre-formatted
43     * and outputs it using a method defined by the actual
44     * implementation. The verbosity is given in case the
45     * implementation wishes to utilise it in the layout -
46     * eg. a different colour or font.
47     *
48     * This instance simply prints the message to the screen.
49     *
50     * @param line A line of formatted text to be logged
51     * @param verbosity the verbosity of this message
52     */
53 tdb 1.4 public synchronized void write(String line, int verbosity) {;
54     System.out.println(line);
55 tdb 1.1 }
56    
57     /**
58     * Overrides the {@link java.lang.Object#toString() Object.toString()}
59     * method to provide clean logging (every class should have this).
60     *
61 tdb 1.6 * This uses the uk.org.iscream.util.FormatName class
62 ajm 1.3 * to format the toString()
63     *
64 tdb 1.1 * @return the name of this class and its CVS revision
65     */
66     public String toString() {
67 ajm 1.3 return FormatName.getName(
68     _name,
69     getClass().getName(),
70     REVISION);
71 tdb 1.1 }
72 ajm 1.3
73 tdb 1.1 //---PRIVATE METHODS---
74 tdb 1.5
75     /**
76     * This method is provided if this class wishes to log
77     * a message itself.
78     *
79     * @param source A String representation of the source
80     * @param verbosity the verbosity of this message
81     * @param message The message to log
82     */
83 tdb 1.4 private void write(String source, int verbosity, String message) {
84     write(FormatName.formatLogLine(source, verbosity, message), verbosity);
85 tdb 1.1 }
86    
87     //---ACCESSOR/MUTATOR METHODS---
88    
89     //---ATTRIBUTES---
90 ajm 1.3
91     /**
92     * This is the friendly identifier of the
93     * component this class is running in.
94     * eg, a Filter may be called "filter1",
95     * If this class does not have an owning
96     * component, a name from the configuration
97     * can be placed here. This name could also
98     * be changed to null for utility classes.
99     */
100     private String _name = Core.NAME;
101 tdb 1.1
102     //---STATIC ATTRIBUTES---
103    
104     }