]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added timestamps to debug window output
authorArtur Signell <artur@vaadin.com>
Mon, 2 Apr 2012 19:29:59 +0000 (22:29 +0300)
committerArtur Signell <artur@vaadin.com>
Wed, 4 Apr 2012 21:08:15 +0000 (00:08 +0300)
src/com/vaadin/terminal/gwt/client/VDebugConsole.java

index 8067f0077ea88f1cd6a771a96e55a0d99bdf8ef7..f28af4040d4c7d2e06a390ebb6a939945d341a11 100644 (file)
@@ -5,6 +5,7 @@
 package com.vaadin.terminal.gwt.client;
 
 import java.util.Collection;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -31,6 +32,7 @@ import com.google.gwt.http.client.RequestCallback;
 import com.google.gwt.http.client.RequestException;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.http.client.UrlBuilder;
+import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.user.client.Cookies;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
@@ -330,6 +332,7 @@ public class VDebugConsole extends VOverlay implements Console {
         if (msg == null) {
             msg = "null";
         }
+        msg = addTimestamp(msg);
         // remoteLog(msg);
 
         logToDebugWindow(msg, false);
@@ -421,7 +424,7 @@ public class VDebugConsole extends VOverlay implements Console {
         if (msg == null) {
             msg = "null";
         }
-
+        msg = addTimestamp(msg);
         logToDebugWindow(msg, true);
 
         GWT.log(msg);
@@ -430,6 +433,15 @@ public class VDebugConsole extends VOverlay implements Console {
 
     }
 
+    DateTimeFormat timestampFormat = DateTimeFormat.getFormat("HH:mm:ss:SSS");
+
+    @SuppressWarnings("deprecation")
+    private String addTimestamp(String msg) {
+        Date date = new Date();
+        String timestamp = timestampFormat.format(date);
+        return timestamp + " " + msg;
+    }
+
     /*
      * (non-Javadoc)
      *