Last change
on this file since 68 was
68,
checked in by cbipsl, 14 years ago
|
commit v1 eccad
|
-
Property svn:executable set to
*
|
File size:
996 bytes
|
Line | |
---|
1 | package org.medias.eccad.helpers; |
---|
2 | |
---|
3 | import org.apache.log4j.Level; |
---|
4 | import org.apache.log4j.Logger; |
---|
5 | import org.apache.log4j.Priority; |
---|
6 | |
---|
7 | public class LoggerPerso { |
---|
8 | public static Logger log; |
---|
9 | public static int DEBUG = 0; |
---|
10 | public static int ERROR = 1; |
---|
11 | public static int WARN = 2; |
---|
12 | public static int INFO = 3; |
---|
13 | |
---|
14 | public static void log(Class appelant, int level, Object message) { |
---|
15 | log = Logger.getLogger(appelant); |
---|
16 | log.log(getPriority(level), message); |
---|
17 | } |
---|
18 | |
---|
19 | public static void log(Class appelant, int level, Object message, Exception e) { |
---|
20 | log = Logger.getLogger(appelant); |
---|
21 | log.log(getPriority(level), message, e); |
---|
22 | } |
---|
23 | |
---|
24 | public static void log(int level, Object message) { |
---|
25 | log = Logger.getLogger(""); |
---|
26 | log.log(getPriority(level), message); |
---|
27 | } |
---|
28 | |
---|
29 | private static Priority getPriority(int level) { |
---|
30 | switch (level) { |
---|
31 | case 0: |
---|
32 | return Level.DEBUG; |
---|
33 | case 1 : |
---|
34 | return Level.ERROR; |
---|
35 | case 2 : |
---|
36 | return Level.WARN; |
---|
37 | case 3 : |
---|
38 | return Level.INFO; |
---|
39 | default: |
---|
40 | return Level.DEBUG; |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.