1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.spf4j.test.log;
17
18 import com.google.common.base.Throwables;
19 import java.util.Collections;
20 import java.util.List;
21 import javax.annotation.Nonnull;
22 import javax.annotation.Nullable;
23 import javax.annotation.ParametersAreNonnullByDefault;
24 import javax.annotation.concurrent.ThreadSafe;
25 import org.slf4j.Marker;
26 import org.spf4j.log.Level;
27 import org.spf4j.log.Slf4jLogRecordImpl;
28
29
30
31
32 @ParametersAreNonnullByDefault
33 @ThreadSafe
34 public final class TestLogRecordImpl extends Slf4jLogRecordImpl implements TestLogRecord {
35
36 public TestLogRecordImpl(final String loggerName, final Level level,
37 final String format, final Object... arguments) {
38 this(loggerName, level, null, format, arguments);
39 }
40
41 public TestLogRecordImpl(final String loggerName, final Level level,
42 @Nullable final Marker marker, final String format, final Object... arguments) {
43 super(loggerName, level, marker, format, arguments);
44 }
45
46
47 @Nonnull
48 @Override
49 public List<Throwable> getExtraThrowableChain() {
50 Throwable extraThrowable = getExtraThrowable();
51 if (extraThrowable == null) {
52 return Collections.EMPTY_LIST;
53 }
54 return Throwables.getCausalChain(extraThrowable);
55 }
56
57 @Override
58 public String toString() {
59 StringBuilder result = new StringBuilder(128);
60 LogPrinter.PRINTER.printTo(result, this, "");
61 return result.toString();
62 }
63
64 }