comparison src/ch/ethz/ssh2/log/Logger.java @ 308:42b15aaa7ac7 ganymed

merge
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:21:50 -0700
parents 071eccdff8ea
children d835e842d158
comparison
equal deleted inserted replaced
306:90e47d99ea54 308:42b15aaa7ac7
12 * used during development. 12 * used during development.
13 * 13 *
14 * @author Christian Plattner 14 * @author Christian Plattner
15 * @version $Id: Logger.java 49 2013-08-01 12:28:42Z cleondris@gmail.com $ 15 * @version $Id: Logger.java 49 2013-08-01 12:28:42Z cleondris@gmail.com $
16 */ 16 */
17 public class Logger 17 public class Logger {
18 { 18 private java.util.logging.Logger delegate;
19 private java.util.logging.Logger delegate;
20 19
21 public static boolean enabled = false; 20 public static boolean enabled = false;
22 21
23 public static Logger getLogger(Class<?> x) 22 public static Logger getLogger(Class<?> x) {
24 { 23 return new Logger(x);
25 return new Logger(x); 24 }
26 }
27 25
28 public Logger(Class<?> x) 26 public Logger(Class<?> x) {
29 { 27 this.delegate = java.util.logging.Logger.getLogger(x.getName());
30 this.delegate = java.util.logging.Logger.getLogger(x.getName()); 28 }
31 }
32 29
33 public final boolean isEnabled() { 30 public final boolean isEnabled() {
34 return enabled; 31 return enabled;
35 } 32 }
36 33
37 public boolean isDebugEnabled() 34 public boolean isDebugEnabled() {
38 { 35 return enabled && delegate.isLoggable(Level.FINER);
39 return enabled && delegate.isLoggable(Level.FINER); 36 }
40 }
41 37
42 public void debug(String message) 38 public void debug(String message) {
43 { 39 if (enabled)
44 if (enabled) 40 delegate.fine(message);
45 delegate.fine(message); 41 }
46 }
47 42
48 public boolean isInfoEnabled() 43 public boolean isInfoEnabled() {
49 { 44 return enabled && delegate.isLoggable(Level.FINE);
50 return enabled && delegate.isLoggable(Level.FINE); 45 }
51 }
52 46
53 public void info(String message) 47 public void info(String message) {
54 { 48 if (enabled)
55 if (enabled) 49 delegate.info(message);
56 delegate.info(message); 50 }
57 }
58 51
59 public boolean isWarningEnabled() 52 public boolean isWarningEnabled() {
60 { 53 return enabled && delegate.isLoggable(Level.WARNING);
61 return enabled && delegate.isLoggable(Level.WARNING); 54 }
62 }
63 55
64 public void warning(String message) 56 public void warning(String message) {
65 { 57 if (enabled)
66 if (enabled) 58 delegate.warning(message);
67 delegate.warning(message); 59 }
68 }
69 } 60 }