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