This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 91420589357 CAMEL-18538: camel-jbang - Log command
91420589357 is described below
commit 91420589357d7e9b245f8d5aae17f59b772dedc7
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Jan 6 17:36:11 2023 +0100
CAMEL-18538: camel-jbang - Log command
---
.../dsl/jbang/core/commands/action/CamelLogAction.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelLogAction.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelLogAction.java
index 574843b7772..2193ff1e25b 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelLogAction.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelLogAction.java
@@ -58,6 +58,10 @@ public class CamelLogAction extends ActionBaseCommand {
@CommandLine.Option(names = { "--logging-color" }, defaultValue = "true",
description = "Use colored logging")
boolean loggingColor = true;
+ @CommandLine.Option(names = { "--timestamp" }, defaultValue = "true",
+ description = "Print timestamp")
+ boolean timestamp = true;
+
@CommandLine.Option(names = { "--follow" }, defaultValue = "true",
description = "Keep following and outputting new log
lines (use ctrl + c to exit).")
boolean follow = true;
@@ -267,6 +271,9 @@ public class CamelLogAction extends ActionBaseCommand {
}
private int compareLogLine(String l1, String l2) {
+ l1 = unescapeAnsi(l1);
+ l2 = unescapeAnsi(l2);
+
String t1 = StringHelper.after(l1, ": ");
t1 = StringHelper.before(t1, " ");
String t2 = StringHelper.after(l2, ": ");
@@ -275,6 +282,14 @@ public class CamelLogAction extends ActionBaseCommand {
}
protected void printLine(String name, String line) {
+ if (!timestamp) {
+ // after timestamp is after 2 sine-space
+ int pos = line.indexOf(' ');
+ pos = line.indexOf(' ', pos + 1);
+ if (pos != -1) {
+ line = line.substring(pos + 1);
+ }
+ }
if (loggingColor) {
if (name != null) {
Ansi.Color color = colors.get(name);