Polishing

This commit is contained in:
Juergen Hoeller
2018-09-15 00:17:17 +02:00
parent db8e9eafb2
commit 8e83f140d4
2 changed files with 7 additions and 6 deletions

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.log;
import java.util.function.Function;
@@ -42,7 +43,7 @@ public final class LogFormatUtils {
* {@link CharSequence}, and possibly truncating at 100 if limitLength is
* set to true.
* @param value the value to format
* @param limitLength whether to truncate large formatted values (over 100).
* @param limitLength whether to truncate large formatted values (over 100)
* @return the formatted value
* @since 5.1
*/
@@ -50,8 +51,8 @@ public final class LogFormatUtils {
if (value == null) {
return "";
}
String s = value instanceof CharSequence ? "\"" + value + "\"" : value.toString();
return limitLength && s.length() > 100 ? s.substring(0, 100) + " (truncated)..." : s;
String s = (value instanceof CharSequence ? "\"" + value + "\"" : value.toString());
return (limitLength && s.length() > 100 ? s.substring(0, 100) + " (truncated)..." : s);
}
/**
@@ -70,7 +71,7 @@ public final class LogFormatUtils {
* </pre>
* @param logger the logger to use to log the message
* @param messageFactory function that accepts a boolean set to the value
* of {@link Log#isTraceEnabled()}.
* of {@link Log#isTraceEnabled()}
*/
public static void traceDebug(Log logger, Function<Boolean, String> messageFactory) {
if (logger.isDebugEnabled()) {