1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.core.async;
18
19 import java.util.Map;
20
21 import org.apache.logging.log4j.Level;
22 import org.apache.logging.log4j.Marker;
23 import org.apache.logging.log4j.ThreadContext.ContextStack;
24 import org.apache.logging.log4j.message.Message;
25
26 import com.lmax.disruptor.EventTranslator;
27
28
29
30
31
32
33
34 public class RingBufferLogEventTranslator implements
35 EventTranslator<RingBufferLogEvent> {
36
37 private AsyncLogger asyncLogger;
38 private String loggerName;
39 private Marker marker;
40 private String fqcn;
41 private Level level;
42 private Message message;
43 private Throwable thrown;
44 private Map<String, String> contextMap;
45 private ContextStack contextStack;
46 private String threadName;
47 private StackTraceElement location;
48 private long currentTimeMillis;
49
50
51 public void translateTo(RingBufferLogEvent event, long sequence) {
52 event.setValues(asyncLogger, loggerName, marker, fqcn, level, message,
53 thrown, contextMap, contextStack, threadName, location,
54 currentTimeMillis);
55 }
56
57 public void setValues(AsyncLogger asyncLogger, String loggerName,
58 Marker marker, String fqcn, Level level, Message message,
59 Throwable thrown, Map<String, String> contextMap,
60 ContextStack contextStack, String threadName,
61 StackTraceElement location, long currentTimeMillis) {
62 this.asyncLogger = asyncLogger;
63 this.loggerName = loggerName;
64 this.marker = marker;
65 this.fqcn = fqcn;
66 this.level = level;
67 this.message = message;
68 this.thrown = thrown;
69 this.contextMap = contextMap;
70 this.contextStack = contextStack;
71 this.threadName = threadName;
72 this.location = location;
73 this.currentTimeMillis = currentTimeMillis;
74 }
75
76 }