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