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/LoggerServant.java
Revision: 1.3
Committed: Tue Dec 12 18:26:52 2000 UTC (23 years, 5 months ago) by ajm
Branch: MAIN
Changes since 1.2: +26 -12 lines
Log Message:
tidied up the code

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2 ajm 1.2 package uk.ac.ukc.iscream.core;
3 tdb 1.1
4     //---IMPORTS---
5 ajm 1.3 import uk.ac.ukc.iscream.util.*;
6 tdb 1.1
7     /**
8     * The ScreenLoggerServant is an implementation of the Logger defined
9     * in the IDL interface. It's only purpose is to simply print all the
10     * logging information it receives to the screen.
11     *
12 ajm 1.3 * @author $Author: ajm4 $
13     * @version $Id: LoggerServant.java,v 1.2 2000/11/29 21:27:08 ajm4 Exp $
14 tdb 1.1 */
15     class LoggerServant extends LoggerPOA {
16    
17     //---FINAL ATTRIBUTES---
18    
19     /**
20     * The current CVS revision of this class
21     */
22 ajm 1.3 public final String REVISION = "$Revision: 1.2 $";
23 tdb 1.1
24     //---STATIC METHODS---
25    
26     //---CONSTRUCTORS---
27    
28     /**
29     * Creates a new LoggerServant.
30     *
31     * @param logger a reference to the LoggerImpl this will use
32     */
33     public LoggerServant(LoggerImpl logger) {
34     _logger = logger;
35     _verbosityLevel = Integer.parseInt(System.getProperty("uk.ac.ukc.iscream.Verbosity"));
36 ajm 1.3 write(toString(), Logger.SYSINIT, "started");
37     write(toString(), Logger.SYSMSG, "using verbosity " + _verbosityLevel);
38 tdb 1.1 }
39    
40     //---PUBLIC METHODS---
41    
42     /**
43     * The write() method simply passes the call on to it's local
44     * LoggerImpl object.
45     *
46     * @param source A string representation of the calling object.
47     * @param verbosity the verbosity of this message
48     * @param message The text to be logged.
49     */
50     public void write(String source, int verbosity, String message) {
51     _logger.write(source, verbosity, message);
52     }
53    
54     /**
55     * Overrides the {@link java.lang.Object#toString() Object.toString()}
56     * method to provide clean logging (every class should have this).
57 ajm 1.3 *
58     * This uses the uk.ac.ukc.iscream.util.FormatName class
59     * to format the toString()
60     *
61 tdb 1.1 * @return the name of this class and its CVS revision
62     */
63     public String toString() {
64 ajm 1.3 return FormatName.getName(
65     _name,
66     getClass().getName(),
67     REVISION);
68 tdb 1.1 }
69 ajm 1.3
70 tdb 1.1 //---PRIVATE METHODS---
71    
72     //---ACCESSOR/MUTATOR METHODS---
73    
74     //---ATTRIBUTES---
75    
76     /**
77     * The verbosity level of this instance
78     */
79     private int _verbosityLevel;
80    
81     /**
82     * The actual Logger used by this instance
83     */
84     private LoggerImpl _logger;
85 ajm 1.3
86     /**
87     * This is the friendly identifier of the
88     * component this class is running in.
89     * eg, a Filter may be called "filter1",
90     * If this class does not have an owning
91     * component, a name from the configuration
92     * can be placed here. This name could also
93     * be changed to null for utility classes.
94     */
95     private String _name = Core.NAME;
96 tdb 1.1
97     //---STATIC ATTRIBUTES---
98    
99     }