-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExample.java
More file actions
54 lines (43 loc) · 1.18 KB
/
Copy pathExample.java
File metadata and controls
54 lines (43 loc) · 1.18 KB
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
package executor.lightLogger;
import java.util.HashSet;
import java.util.Set;
import executor.lightLogger.level.Default;
import executor.lightLogger.level.ILevel;
import executor.lightLogger.level.Level;
import executor.lightLogger.logger.ILogger;
/**
* Example how LightLogger could be used.
*
* @author executor
*
*/
public class Example {
public static void main(String[] args) {
ILogger log = Logger.getInstance(Example.class);
doLogCalls(log);
log.setLogMask(Default.ERROR);
doLogCalls(log);
Set<ILevel> newLogMask = new HashSet<ILevel>();
newLogMask.add(Default.INFO);
newLogMask.add(Default.WARN);
log.setLogMask(newLogMask);
doLogCalls(log);
}
@SuppressWarnings("null")
private static void doLogCalls(ILogger log) {
System.out.println("LogMask: " + log.getLogMask());
log.fatal("fatal crash");
log.error("error occurred");
Object o = null;
try {
o.toString();
} catch(Exception e) {
log.error("Error on calling toString()", e);
}
log.warn("warning about coffee stock");
log.info("coffee is ready");
log.debug("debug problems");
log.trace("trace method calls");
log.log(new Level("COOKIES!", 256), "foo barrr");
}
}