annotate src/goodjava/logging/Slf4jFactory.java @ 1522:bafe6a6797ce

blasma.html
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 28 Jun 2020 13:13:19 -0600
parents c15444f4da05
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1452
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 package goodjava.logging;
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 public final class Slf4jFactory implements ILoggerFactory {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 private static final class Slf4jLogger implements Logger {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 final org.slf4j.Logger slf4j;
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 Slf4jLogger(org.slf4j.Logger slf4j) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 this.slf4j = slf4j;
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 @Override public void error(String msg) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 slf4j.error(msg);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 @Override public void error(String msg,Throwable t) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 slf4j.error(msg,t);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 @Override public void warn(String msg) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 slf4j.warn(msg);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 @Override public void warn(String msg,Throwable t) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 slf4j.warn(msg,t);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 @Override public void info(String msg) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 slf4j.info(msg);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 @Override public void info(String msg,Throwable t) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 slf4j.info(msg,t);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 @Override public boolean isInfoEnabled() {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 return slf4j.isInfoEnabled();
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 @Override public void debug(String msg) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 slf4j.debug(msg);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 @Override public void debug(String msg,Throwable t) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 slf4j.debug(msg,t);
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 @Override public boolean isDebugEnabled() {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49 return slf4j.isDebugEnabled();
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53 @Override public Logger getLogger(String name) {
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
54 return new Slf4jLogger(org.slf4j.LoggerFactory.getLogger(name));
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
55 }
c15444f4da05 Slf4jFactory
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56 }