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/MultiLogger.java
Revision: 1.6
Committed: Sun Feb 25 20:49:20 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.5: +23 -14 lines
Log Message:
Sorted out the javadoc comments.

File Contents

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