View Javadoc

1   /*
2    *  Copyright 1999-2004 The Apache Software Foundation.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package org.apache.struts.flow.core;
17  
18  /***
19   *  Simple logger. Can be extended to hook into any logging system, but by
20   *  default, prints messages to the console.
21   */
22  public class Logger {
23  
24      /***
25       *  Logs an error
26       *
27       *@param  msg  The message
28       */
29      public void error(String msg) {
30          System.out.println("JS-ERROR: " + msg);
31      }
32  
33  
34      /***
35       *  Logs a warning
36       *
37       *@param  msg  The message
38       */
39      public void warn(String msg) {
40          System.out.println("JS-WARNING: " + msg);
41      }
42  
43  
44      /***
45       *  Logs an info message
46       *
47       *@param  msg  The message
48       */
49      public void info(String msg) {
50          System.out.println("JS-INFO: " + msg);
51      }
52  
53  
54      /***
55       *  Logs a debugging message
56       *
57       *@param  msg  The message
58       */
59      public void debug(String msg) {
60          System.out.println("JS-DEBUG: " + msg);
61      }
62      
63      /***
64       *  Logs a debugging message
65       *
66       *@param  msg  The message
67       */
68      public void debug(String msg, Throwable t) {
69          System.out.println("JS-DEBUG: " + msg);
70          t.printStackTrace();
71      }
72  
73  
74      /***
75       *  Gets whether debug is enabled
76       *
77       *@return    True if enabled
78       */
79      public boolean isDebugEnabled() {
80          return true;
81      }
82  
83  
84      /***
85       *  Prints an exception
86       *
87       *@param  e  The exception
88       */
89      public void error(Exception e) {
90          e.printStackTrace();
91      }
92  }