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.2
Committed: Wed Nov 29 21:27:25 2000 UTC (23 years, 6 months ago) by ajm
Branch: MAIN
Branch point for: SERVER_PACKAGEBUILD
Changes since 1.1: +5 -3 lines
Log Message:
Update for package move.

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.2 import uk.ac.ukc.iscream.core.LoggerImpl;
6     import uk.ac.ukc.iscream.core.Logger;
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 ajm 1.2 * @author $Author: tdb1 $
14     * @version $Id: MultiLogger.java,v 1.1 2000/11/20 18:35:18 tdb1 Exp $
15 tdb 1.1 */
16     class MultiLogger implements LoggerImpl {
17    
18     //---FINAL ATTRIBUTES---
19    
20     /**
21     * The current CVS revision of this class
22     */
23     public final String REVISION = "$Revision: 1.1 $";
24    
25     //---STATIC METHODS---
26    
27     //---CONSTRUCTORS---
28    
29     /**
30     * Creates a new MultiLogger.
31     */
32     public MultiLogger() throws IOException {
33     _screenlog = new ScreenLogger();
34     _filelog = new FileLogger();
35     write(this.toString(), Logger.SYSINIT, "started");
36     }
37    
38     //---PUBLIC METHODS---
39    
40     /**
41     * The write() method takes a message, formats it using the
42     * formatLogLine() method, and then outputs it to the screen
43     * using System.out.println(). The source is usually the
44     * calling object, referenced by `this'. The method has been
45     * made synchronized to avoid it being called by two different
46     * objects and the output ending up merged on the screen.
47     *
48     * @param source A string representation of the calling object.
49     * @param verbosity the verbosity of this message
50     * @param message The text to be logged.
51     */
52     public synchronized void write(String source, int verbosity, String message) {
53     _screenlog.write(source, verbosity, message);
54     _filelog.write(source, verbosity, message);
55     }
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     * @return the name of this class and its CVS revision
62     */
63     public String toString() {
64     return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
65     }
66     //---PRIVATE METHODS---
67    
68     //---ACCESSOR/MUTATOR METHODS---
69    
70     //---ATTRIBUTES---
71    
72     /**
73     * A reference to the ScreenLogger we'll use
74     */
75     private LoggerImpl _screenlog;
76    
77     /**
78     * A reference to the FileLogger we'll use
79     */
80     private LoggerImpl _filelog;
81    
82     //---STATIC ATTRIBUTES---
83    
84     }