1
2
3
4
5
6
7
8
9
10
11 package psiprobe.tools.logging.commons;
12
13 import psiprobe.tools.logging.LogDestination;
14 import psiprobe.tools.logging.jdk.Jdk14LoggerAccessor;
15 import psiprobe.tools.logging.log4j.Log4JLoggerAccessor;
16
17
18
19
20 public class GetSingleDestinationVisitor extends AbstractLoggerAccessorVisitor {
21
22
23 private final String logIndex;
24
25
26 private LogDestination destination;
27
28
29
30
31
32
33 public GetSingleDestinationVisitor(String logIndex) {
34 this.logIndex = logIndex;
35 }
36
37
38
39
40
41
42 public LogDestination getDestination() {
43 return destination;
44 }
45
46 @Override
47 public void visit(Log4JLoggerAccessor accessor) {
48 LogDestination dest = accessor.getAppender(logIndex);
49 if (dest != null) {
50 destination = dest;
51 }
52 }
53
54 @Override
55 public void visit(Jdk14LoggerAccessor accessor) {
56 LogDestination dest = accessor.getHandler(logIndex);
57 if (dest != null) {
58 destination = dest;
59 }
60 }
61
62 }