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