From 9a9269d57a82159cd218bd992a9eab4bbc251f89 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 2 Apr 2012 22:29:59 +0300 Subject: [PATCH] Added timestamps to debug window output --- .../vaadin/terminal/gwt/client/VDebugConsole.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index 8067f0077e..f28af4040d 100644 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -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) * -- 2.39.5