You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/12/04 15:43:50 UTC

[isis] branch master updated (5efa8d5 -> c338409)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git.


 discard 5efa8d5  ISIS-2903: Xray: adds timestamps to log-entires
     new c338409  ISIS-2903: Xray: adds timestamps to log-entires

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5efa8d5)
            \
             N -- N -- N   refs/heads/master (c338409)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/debug/xray/JavaApplication78.java     | 76 ----------------------
 1 file changed, 76 deletions(-)
 delete mode 100644 commons/src/main/java/org/apache/isis/commons/internal/debug/xray/JavaApplication78.java

[isis] 01/01: ISIS-2903: Xray: adds timestamps to log-entires

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit c3384094bb3a7d518a29ed3f7ea2572b2289b0c5
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sat Dec 4 16:40:43 2021 +0100

    ISIS-2903: Xray: adds timestamps to log-entires
    
    - in a multi-threaded history we need a way to tell which call-stack
    happened first
---
 .../apache/isis/commons/internal/debug/_Xray.java   |  5 ++++-
 .../commons/internal/debug/xray/XrayDataModel.java  | 21 +++++++++++++++++----
 .../commons/internal/debug/xray/_SwingUtil.java     | 19 +++++++++++++++++++
 3 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/commons/src/main/java/org/apache/isis/commons/internal/debug/_Xray.java b/commons/src/main/java/org/apache/isis/commons/internal/debug/_Xray.java
index 8712766..a64688d 100644
--- a/commons/src/main/java/org/apache/isis/commons/internal/debug/_Xray.java
+++ b/commons/src/main/java/org/apache/isis/commons/internal/debug/_Xray.java
@@ -18,6 +18,8 @@
  */
 package org.apache.isis.commons.internal.debug;
 
+import java.time.LocalDateTime;
+
 import org.apache.isis.commons.collections.Can;
 import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.commons.internal.debug.xray.XrayDataModel;
@@ -40,13 +42,14 @@ final class _Xray {
         }
 
         val threadId = ThreadMemento.fromCurrentThread();
+        val timeStamp = LocalDateTime.now();
 
         XrayUi.updateModel(model->{
             val parentNode = model.getThreadNode(threadId);
 
             val logModel = model.addDataNode(parentNode,
                     new XrayDataModel.LogEntry(
-                            "debug-log",
+                            "debug-log", timeStamp,
                             _Strings.ellipsifyAtEnd(logMessage, 80, "..."),
                             logMessage,
                             Stickiness.CAN_DELETE_NODE));
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/XrayDataModel.java b/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/XrayDataModel.java
index 833456e..c5677cd 100644
--- a/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/XrayDataModel.java
+++ b/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/XrayDataModel.java
@@ -21,6 +21,8 @@ package org.apache.isis.commons.internal.debug.xray;
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Graphics2D;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -29,6 +31,7 @@ import java.util.UUID;
 
 import javax.swing.BorderFactory;
 import javax.swing.JEditorPane;
+import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 
@@ -100,6 +103,7 @@ public abstract class XrayDataModel extends HasIdAndLabel {
         private final List<StackTraceElement> data = new ArrayList<>();
 
         private final String id;
+        private final LocalDateTime timestamp;
         private final String label;
         private final String logMessage;
         private final @NonNull Stickiness stickiness;
@@ -117,10 +121,19 @@ public abstract class XrayDataModel extends HasIdAndLabel {
 
             // log message label
 
-            val editorPane = new JEditorPane();
-            editorPane.setEditable(false);
-            editorPane.setText(logMessage);
-            panel2.add(editorPane, BorderLayout.NORTH);
+            val logMessagePane = new JEditorPane();
+            logMessagePane.setEditable(false);
+            logMessagePane.setText(logMessage);
+
+            val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
+
+            val timestampLabel = new JLabel(timestamp.format(formatter));
+
+            panel2.add(
+                    _SwingUtil.verticalBox(
+                            timestampLabel,
+                            logMessagePane),
+                    BorderLayout.NORTH);
 
             // table rendering
 
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/_SwingUtil.java b/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/_SwingUtil.java
index 5670991..0723561 100644
--- a/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/_SwingUtil.java
+++ b/commons/src/main/java/org/apache/isis/commons/internal/debug/xray/_SwingUtil.java
@@ -21,6 +21,9 @@ package org.apache.isis.commons.internal.debug.xray;
 import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.util.Collections;
 import java.util.function.Consumer;
 
@@ -87,4 +90,20 @@ final class _SwingUtil {
         return canvas;
     }
 
+    public static Component verticalBox(final Component ...components) {
+
+        val panel = new JPanel(new GridBagLayout());
+        val gbc = new GridBagConstraints();
+        gbc.weightx = 1;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        gbc.gridwidth = GridBagConstraints.REMAINDER;
+        gbc.insets = new Insets(3, 6, 3, 6);
+
+        for(val component : components) {
+            panel.add(component, gbc);
+        }
+
+        return panel;
+    }
+
 }