1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.internal;
20
21 import org.apache.maven.plugin.logging.Log;
22 import org.slf4j.Logger;
23
24 import static java.util.Objects.requireNonNull;
25
26
27
28
29 public class MojoLogWrapper implements Log {
30 private final Logger logger;
31
32 public MojoLogWrapper(Logger logger) {
33 this.logger = requireNonNull(logger);
34 }
35
36 public void debug(CharSequence content) {
37 logger.debug(toString(content));
38 }
39
40 private String toString(CharSequence content) {
41 if (content == null) {
42 return "";
43 } else {
44 return content.toString();
45 }
46 }
47
48 @Override
49 public void debug(CharSequence content, Throwable error) {
50 logger.debug(toString(content), error);
51 }
52
53 @Override
54 public void debug(Throwable error) {
55 logger.debug("", error);
56 }
57
58 @Override
59 public void info(CharSequence content) {
60 logger.info(toString(content));
61 }
62
63 @Override
64 public void info(CharSequence content, Throwable error) {
65 logger.info(toString(content), error);
66 }
67
68 @Override
69 public void info(Throwable error) {
70 logger.info("", error);
71 }
72
73 @Override
74 public void warn(CharSequence content) {
75 logger.warn(toString(content));
76 }
77
78 @Override
79 public void warn(CharSequence content, Throwable error) {
80 logger.warn(toString(content), error);
81 }
82
83 @Override
84 public void warn(Throwable error) {
85 logger.warn("", error);
86 }
87
88 @Override
89 public void error(CharSequence content) {
90 logger.error(toString(content));
91 }
92
93 @Override
94 public void error(CharSequence content, Throwable error) {
95 logger.error(toString(content), error);
96 }
97
98 @Override
99 public void error(Throwable error) {
100 logger.error("", error);
101 }
102
103 @Override
104 public boolean isDebugEnabled() {
105 return logger.isDebugEnabled();
106 }
107
108 @Override
109 public boolean isInfoEnabled() {
110 return logger.isInfoEnabled();
111 }
112
113 @Override
114 public boolean isWarnEnabled() {
115 return logger.isWarnEnabled();
116 }
117
118 @Override
119 public boolean isErrorEnabled() {
120 return logger.isErrorEnabled();
121 }
122 }