1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.internal.test.util;
20
21 import java.io.PrintStream;
22
23 import org.eclipse.aether.spi.log.Logger;
24 import org.eclipse.aether.spi.log.LoggerFactory;
25
26
27
28
29
30
31 @Deprecated
32 public final class TestLoggerFactory implements LoggerFactory {
33
34 private final Logger logger;
35
36
37
38
39 public TestLoggerFactory() {
40 this(null);
41 }
42
43
44
45
46 public TestLoggerFactory(PrintStream out) {
47 logger = new TestLogger(out);
48 }
49
50 public Logger getLogger(String name) {
51 return logger;
52 }
53
54 private static final class TestLogger implements Logger {
55
56 private final PrintStream out;
57
58 TestLogger(PrintStream out) {
59 this.out = (out != null) ? out : System.out;
60 }
61
62 public boolean isWarnEnabled() {
63 return true;
64 }
65
66 public void warn(String msg, Throwable error) {
67 out.println("[WARN] " + msg);
68 if (error != null) {
69 error.printStackTrace(out);
70 }
71 }
72
73 public void warn(String msg) {
74 warn(msg, null);
75 }
76
77 public boolean isDebugEnabled() {
78 return true;
79 }
80
81 public void debug(String msg, Throwable error) {
82 out.println("[DEBUG] " + msg);
83 if (error != null) {
84 error.printStackTrace(out);
85 }
86 }
87
88 public void debug(String msg) {
89 debug(msg, null);
90 }
91 }
92 }