From 0cfccc70d8af81caa2a847e86bb28584f7222761 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 5 Jul 2024 21:03:56 +0100 Subject: [PATCH] update log format for messages --- .../java/cc/fascinated/bat/features/logging/LogFeature.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/features/logging/LogFeature.java b/src/main/java/cc/fascinated/bat/features/logging/LogFeature.java index 06ac076..0a82dde 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/LogFeature.java +++ b/src/main/java/cc/fascinated/bat/features/logging/LogFeature.java @@ -58,12 +58,15 @@ public class LogFeature extends Feature { if (content == null) { return "No content"; } - if (content.length() > 512) { + // More than 512 characters or is more than 4 lines + if (content.length() > 512 || content.chars().filter(ch -> ch == '\n').count() > 4) { return "*Content too long, [click here to view]("+PasteUtils.uploadPaste(content).getUrl()+")*"; } + // Less than or equal to 32 characters and no new lines if (content.length() <= 32 && !content.contains("\n")) { return "`%s`".formatted(content); } + // Everything else return "\n```\n%s\n```".formatted(content); } }