1 package org.apache.maven.plugin.logging;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.PrintWriter;
23 import java.io.StringWriter;
24
25
26
27
28
29
30
31
32 @Deprecated
33 public class SystemStreamLog
34 implements Log
35 {
36
37
38
39 public void debug( CharSequence content )
40 {
41 print( "debug", content );
42 }
43
44
45
46
47 public void debug( CharSequence content, Throwable error )
48 {
49 print( "debug", content, error );
50 }
51
52
53
54
55 public void debug( Throwable error )
56 {
57 print( "debug", error );
58 }
59
60
61
62
63 public void info( CharSequence content )
64 {
65 print( "info", content );
66 }
67
68
69
70
71 public void info( CharSequence content, Throwable error )
72 {
73 print( "info", content, error );
74 }
75
76
77
78
79 public void info( Throwable error )
80 {
81 print( "info", error );
82 }
83
84
85
86
87 public void warn( CharSequence content )
88 {
89 print( "warn", content );
90 }
91
92
93
94
95 public void warn( CharSequence content, Throwable error )
96 {
97 print( "warn", content, error );
98 }
99
100
101
102
103 public void warn( Throwable error )
104 {
105 print( "warn", error );
106 }
107
108
109
110
111 public void error( CharSequence content )
112 {
113 System.err.println( "[error] " + content.toString() );
114 }
115
116
117
118
119 public void error( CharSequence content, Throwable error )
120 {
121 StringWriter sWriter = new StringWriter();
122 PrintWriter pWriter = new PrintWriter( sWriter );
123
124 error.printStackTrace( pWriter );
125
126 System.err.println( "[error] " + content.toString()
127 + System.lineSeparator() + System.lineSeparator() + sWriter.toString() );
128 }
129
130
131
132
133 public void error( Throwable error )
134 {
135 StringWriter sWriter = new StringWriter();
136 PrintWriter pWriter = new PrintWriter( sWriter );
137
138 error.printStackTrace( pWriter );
139
140 System.err.println( "[error] " + sWriter.toString() );
141 }
142
143
144
145
146 public boolean isDebugEnabled()
147 {
148
149 return false;
150 }
151
152
153
154
155 public boolean isInfoEnabled()
156 {
157 return true;
158 }
159
160
161
162
163 public boolean isWarnEnabled()
164 {
165 return true;
166 }
167
168
169
170
171 public boolean isErrorEnabled()
172 {
173 return true;
174 }
175
176 private void print( String prefix, CharSequence content )
177 {
178 System.out.println( "[" + prefix + "] " + content.toString() );
179 }
180
181 private void print( String prefix, Throwable error )
182 {
183 StringWriter sWriter = new StringWriter();
184 PrintWriter pWriter = new PrintWriter( sWriter );
185
186 error.printStackTrace( pWriter );
187
188 System.out.println( "[" + prefix + "] " + sWriter.toString() );
189 }
190
191 private void print( String prefix, CharSequence content, Throwable error )
192 {
193 StringWriter sWriter = new StringWriter();
194 PrintWriter pWriter = new PrintWriter( sWriter );
195
196 error.printStackTrace( pWriter );
197
198 System.out.println( "[" + prefix + "] " + content.toString()
199 + System.lineSeparator() + System.lineSeparator() + sWriter.toString() );
200 }
201 }