@@ -48,6 +48,8 @@ public class Logger {
48
48
49
49
private boolean appendOnly ;
50
50
51
+ private boolean logOnly ;
52
+
51
53
public void setAppender (LogAppender appender ) {
52
54
this .appender = appender ;
53
55
}
@@ -68,6 +70,14 @@ public boolean isAppendOnly() {
68
70
return appendOnly ;
69
71
}
70
72
73
+ public void setLogOnly (boolean logOnly ) {
74
+ this .logOnly = logOnly ;
75
+ }
76
+
77
+ public boolean isLogOnly () {
78
+ return logOnly ;
79
+ }
80
+
71
81
public Logger (Class clazz ) {
72
82
LOGGER = LoggerFactory .getLogger (clazz );
73
83
}
@@ -85,7 +95,9 @@ public void trace(String format, Object... arguments) {
85
95
if (!appendOnly ) {
86
96
LOGGER .trace (format , arguments );
87
97
}
88
- formatAndAppend (format , arguments );
98
+ if (!logOnly ) {
99
+ formatAndAppend (format , arguments );
100
+ }
89
101
}
90
102
}
91
103
@@ -94,7 +106,9 @@ public void debug(String format, Object... arguments) {
94
106
if (!appendOnly ) {
95
107
LOGGER .debug (format , arguments );
96
108
}
97
- formatAndAppend (format , arguments );
109
+ if (!logOnly ) {
110
+ formatAndAppend (format , arguments );
111
+ }
98
112
}
99
113
}
100
114
@@ -103,7 +117,9 @@ public void info(String format, Object... arguments) {
103
117
if (!appendOnly ) {
104
118
LOGGER .info (format , arguments );
105
119
}
106
- formatAndAppend (format , arguments );
120
+ if (!logOnly ) {
121
+ formatAndAppend (format , arguments );
122
+ }
107
123
}
108
124
}
109
125
@@ -112,7 +128,9 @@ public void warn(String format, Object... arguments) {
112
128
if (!appendOnly ) {
113
129
LOGGER .warn (format , arguments );
114
130
}
115
- formatAndAppend (format , arguments );
131
+ if (!logOnly ) {
132
+ formatAndAppend (format , arguments );
133
+ }
116
134
}
117
135
}
118
136
@@ -121,7 +139,9 @@ public void error(String format, Object... arguments) {
121
139
if (!appendOnly ) {
122
140
LOGGER .error (format , arguments );
123
141
}
124
- formatAndAppend (format , arguments );
142
+ if (!logOnly ) {
143
+ formatAndAppend (format , arguments );
144
+ }
125
145
}
126
146
}
127
147
0 commit comments