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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/**
* Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eike Stepper - initial API and implementation
*/
package org.eclipse.net4j.util.om.log;
import org.eclipse.net4j.internal.util.bundle.AbstractPlatform;
import org.eclipse.net4j.util.om.OMBundle;
/**
* @author Eike Stepper
*/
public class Logger implements OMLogger
{
private OMBundle bundle;
public Logger(OMBundle bundle)
{
this.bundle = bundle;
}
public OMBundle getBundle()
{
return bundle;
}
public void log(Level level, String msg, Throwable t)
{
((AbstractPlatform)bundle.getPlatform()).log(this, level, msg, t);
}
public void error(String msg, Throwable t)
{
log(Level.ERROR, msg, t);
}
public void warn(String msg, Throwable t)
{
log(Level.WARN, msg, t);
}
public void info(String msg, Throwable t)
{
log(Level.INFO, msg, t);
}
public void debug(String msg, Throwable t)
{
log(Level.DEBUG, msg, t);
}
public void log(Level level, String msg)
{
log(level, msg, null);
}
public void error(String msg)
{
log(Level.ERROR, msg);
}
public void warn(String msg)
{
log(Level.WARN, msg);
}
public void info(String msg)
{
log(Level.INFO, msg);
}
public void debug(String msg)
{
log(Level.DEBUG, msg);
}
public void log(Level level, Throwable t)
{
String msg = t.getMessage();
if (msg == null)
{
msg = t.getClass().getSimpleName();
}
log(level, msg, t);
}
public void error(Throwable t)
{
log(Level.ERROR, t);
}
public void warn(Throwable t)
{
log(Level.WARN, t);
}
public void info(Throwable t)
{
log(Level.INFO, t);
}
public void debug(Throwable t)
{
log(Level.DEBUG, t);
}
}
|