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