blob: fe1a9441462411ca3f3966ff688d55e8e266c29d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package com.trilead.ssh2.log;
/**
* Logger - a very simple logger, mainly used during development.
* Is not based on log4j (to reduce external dependencies).
* However, if needed, something like log4j could easily be
* hooked in.
*
* @author Christian Plattner, plattner@trilead.com
* @version $Id: Logger.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $
*/
public class Logger
{
private static final boolean enabled = false;
private static final int logLevel = 99;
private String className;
public final static Logger getLogger(Class x)
{
return new Logger(x);
}
public Logger(Class x)
{
this.className = x.getName();
}
public final boolean isEnabled()
{
return enabled;
}
public final void log(int level, String message)
{
if ((enabled) && (level <= logLevel))
{
long now = System.currentTimeMillis();
synchronized (this)
{
System.err.println(now + " : " + className + ": " + message);
// or send it to log4j or whatever...
}
}
}
}
|