annotate src/ch/ethz/ssh2/log/Logger.java @ 309:cb179051f0f2 ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:29:39 -0700
parents 071eccdff8ea
children d835e842d158
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
1 /*
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
3 * Please refer to the LICENSE.txt for licensing details.
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
4 */
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
5
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
6 package ch.ethz.ssh2.log;
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
7
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
8 import java.util.logging.Level;
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
9
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
10 /**
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
11 * Logger delegating to JRE logging. By default, this is disabled and only
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
12 * used during development.
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
13 *
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
14 * @author Christian Plattner
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
15 * @version $Id: Logger.java 49 2013-08-01 12:28:42Z cleondris@gmail.com $
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
16 */
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
17 public class Logger {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
18 private java.util.logging.Logger delegate;
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
19
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
20 public static boolean enabled = false;
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
21
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
22 public static Logger getLogger(Class<?> x) {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
23 return new Logger(x);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
24 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
25
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
26 public Logger(Class<?> x) {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
27 this.delegate = java.util.logging.Logger.getLogger(x.getName());
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
28 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
29
284
4ec87de11e71 start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents: 273
diff changeset
30 public final boolean isEnabled() {
4ec87de11e71 start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents: 273
diff changeset
31 return enabled;
4ec87de11e71 start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents: 273
diff changeset
32 }
4ec87de11e71 start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents: 273
diff changeset
33
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
34 public boolean isDebugEnabled() {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
35 return enabled && delegate.isLoggable(Level.FINER);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
36 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
37
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
38 public void debug(String message) {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
39 if (enabled)
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
40 delegate.fine(message);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
41 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
42
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
43 public boolean isInfoEnabled() {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
44 return enabled && delegate.isLoggable(Level.FINE);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
45 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
46
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
47 public void info(String message) {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
48 if (enabled)
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
49 delegate.info(message);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
50 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
51
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
52 public boolean isWarningEnabled() {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
53 return enabled && delegate.isLoggable(Level.WARNING);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
54 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
55
307
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
56 public void warning(String message) {
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
57 if (enabled)
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
58 delegate.warning(message);
071eccdff8ea fix java formatting
Carl Byington <carl@five-ten-sg.com>
parents: 284
diff changeset
59 }
273
91a31873c42a start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
60 }