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/SimpleGUILogger.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/core/loggers/SimpleGUILogger.java (file contents):
Revision 1.4 by tdb, Mon Jan 22 21:29:21 2001 UTC vs.
Revision 1.5 by tdb, Sun Feb 25 20:34:17 2001 UTC

# Line 44 | Line 44 | public class SimpleGUILogger implements LoggerImpl {
44       * Creates a new ScreenLoggerServant.
45       */
46      public SimpleGUILogger() {
47        _verbosityLevel = Integer.parseInt(System.getProperty("uk.ac.ukc.iscream.Verbosity"));
47          _maxMessages = Integer.parseInt(System.getProperty("uk.ac.ukc.iscream.LoggerClass.SimpleGUILogger.maxMessages"));
48          
49          getFrame().add(getTextArea());
# Line 52 | Line 51 | public class SimpleGUILogger implements LoggerImpl {
51          getFrame().setVisible(true);
52          
53          write(toString(), Logger.SYSINIT, "started");
55        write(toString(), Logger.SYSMSG, "using verbosity " + _verbosityLevel);
54      }
55  
56   //---PUBLIC METHODS---
# Line 69 | Line 67 | public class SimpleGUILogger implements LoggerImpl {
67           * @param verbosity the verbosity of this message
68           * @param message The text to be logged.
69           */  
70 <    public synchronized void write(String source, int verbosity, String message) {
71 <        if (verbosity <= _verbosityLevel) {
72 <                String line = formatLogLine(source, message);
75 <                getTextArea().append(line + "\n");
76 <                getTextArea().setRows(_maxMessages);
77 <        }
70 >    public synchronized void write(String line, int verbosity) {
71 >        getTextArea().append(line + "\n");
72 >        getTextArea().setRows(_maxMessages);
73      }
74        
75     /**
# Line 95 | Line 90 | public class SimpleGUILogger implements LoggerImpl {
90      
91   //---PRIVATE METHODS---
92  
93 <        /**
94 <         * This method generates a nicely formatted line for the log,
100 <         * including the date/time and the source of the message. The date
101 <         * and time are formatted using the DateFormat class, and the source
102 <         * class is formatted using the toString() method found in every
103 <         * source file. This is then prepended to the message and returned.
104 <         *
105 <         * @param source A string representation of the calling object.
106 <         * @param message The message to be logged.
107 <         * @return The string to be written to the log.
108 <         */
109 <    private String formatLogLine(String source, String message){
110 <        String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date());
111 <        return "[" + date + "] " + source + ": " + message;
93 >    private void write(String source, int verbosity, String message) {
94 >        write(FormatName.formatLogLine(source, verbosity, message), verbosity);
95      }
96  
97   //---ACCESSOR/MUTATOR METHODS---
# Line 132 | Line 115 | public class SimpleGUILogger implements LoggerImpl {
115      }
116  
117   //---ATTRIBUTES---
118 <
136 <        /**
137 <         * The verbosity level of this instance
138 <         */
139 <        private int _verbosityLevel;
140 <          
118 >  
119      /**
120       * a frame
121       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines