Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/log/Logger.java @ 273:91a31873c42a ganymed
start conversion from trilead to ganymed
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 18 Jul 2014 11:21:46 -0700 |
parents | |
children | 4ec87de11e71 |
comparison
equal
deleted
inserted
replaced
272:ce2f4e397703 | 273:91a31873c42a |
---|---|
1 /* | |
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved. | |
3 * Please refer to the LICENSE.txt for licensing details. | |
4 */ | |
5 | |
6 package ch.ethz.ssh2.log; | |
7 | |
8 import java.util.logging.Level; | |
9 | |
10 /** | |
11 * Logger delegating to JRE logging. By default, this is disabled and only | |
12 * used during development. | |
13 * | |
14 * @author Christian Plattner | |
15 * @version $Id: Logger.java 49 2013-08-01 12:28:42Z cleondris@gmail.com $ | |
16 */ | |
17 public class Logger | |
18 { | |
19 private java.util.logging.Logger delegate; | |
20 | |
21 public static volatile boolean enabled = false; | |
22 | |
23 public static Logger getLogger(Class<?> x) | |
24 { | |
25 return new Logger(x); | |
26 } | |
27 | |
28 public Logger(Class<?> x) | |
29 { | |
30 this.delegate = java.util.logging.Logger.getLogger(x.getName()); | |
31 } | |
32 | |
33 public boolean isDebugEnabled() | |
34 { | |
35 return enabled && delegate.isLoggable(Level.FINER); | |
36 } | |
37 | |
38 public void debug(String message) | |
39 { | |
40 if (enabled) | |
41 delegate.fine(message); | |
42 } | |
43 | |
44 public boolean isInfoEnabled() | |
45 { | |
46 return enabled && delegate.isLoggable(Level.FINE); | |
47 } | |
48 | |
49 public void info(String message) | |
50 { | |
51 if (enabled) | |
52 delegate.info(message); | |
53 } | |
54 | |
55 public boolean isWarningEnabled() | |
56 { | |
57 return enabled && delegate.isLoggable(Level.WARNING); | |
58 } | |
59 | |
60 public void warning(String message) | |
61 { | |
62 if (enabled) | |
63 delegate.warning(message); | |
64 } | |
65 } |