diff options
Diffstat (limited to 'client/src/com')
8 files changed, 73 insertions, 93 deletions
diff --git a/client/src/com/vaadin/Vaadin.gwt.xml b/client/src/com/vaadin/Vaadin.gwt.xml index 6529743503..7316a77292 100644 --- a/client/src/com/vaadin/Vaadin.gwt.xml +++ b/client/src/com/vaadin/Vaadin.gwt.xml @@ -12,7 +12,13 @@ <inherits name="com.google.gwt.http.HTTP" /> <inherits name="com.google.gwt.json.JSON" /> - + + <inherits name="com.google.gwt.logging.Logging" /> + <!-- Firebug handler is deprecated but for some reason still enabled by default --> + <set-property name="gwt.logging.firebugHandler" value="DISABLED" /> + <!-- Disable popup logging as we have our own popup logger --> + <set-property name="gwt.logging.popupHandler" value="DISABLED" /> + <inherits name="com.vaadin.VaadinBrowserSpecificOverrides" /> <source path="client" /> diff --git a/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java b/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java index 4b9e831ec5..9397e27906 100644 --- a/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java +++ b/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java @@ -16,6 +16,8 @@ package com.vaadin.client.debug.internal; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import com.google.gwt.core.shared.GWT; import com.google.gwt.event.shared.UmbrellaException; @@ -51,11 +53,7 @@ public class ConsoleAdapter implements Console { @Override public void log(String msg) { - window.log(Level.LOG, msg); - - GWT.log(msg); - consoleLog(msg); - System.out.println(msg); + getLogger().log(Level.INFO, msg); } @Override @@ -81,11 +79,8 @@ public class ConsoleAdapter implements Console { if (msg == null) { msg = "null"; } - window.log(Level.ERROR, msg); - GWT.log(msg); - consoleErr(msg); - System.out.println(msg); + getLogger().log(Level.SEVERE, msg); } @Override @@ -187,4 +182,8 @@ public class ConsoleAdapter implements Console { $wnd.console.log(msg); } }-*/; + + private static Logger getLogger() { + return Logger.getLogger(ConsoleAdapter.class.getName()); + } } diff --git a/client/src/com/vaadin/client/debug/internal/HierarchySection.java b/client/src/com/vaadin/client/debug/internal/HierarchySection.java index 7b43f551e3..b09038cf97 100644 --- a/client/src/com/vaadin/client/debug/internal/HierarchySection.java +++ b/client/src/com/vaadin/client/debug/internal/HierarchySection.java @@ -146,11 +146,6 @@ class HierarchySection implements Section { stopFind(); } - @Override - public void log(Level level, String msg) { - // NOP - } - private void generateWidgetset() { content.clear(); diff --git a/client/src/com/vaadin/client/debug/internal/Level.java b/client/src/com/vaadin/client/debug/internal/Level.java deleted file mode 100644 index 3ce314d5cb..0000000000 --- a/client/src/com/vaadin/client/debug/internal/Level.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.client.debug.internal; - -/** - * Log level for debug messages. - * - * @since 7.1 - * @author Vaadin Ltd - */ -enum Level { - DEBUG, LOG, WARNING, ERROR -} diff --git a/client/src/com/vaadin/client/debug/internal/LogSection.java b/client/src/com/vaadin/client/debug/internal/LogSection.java index 0285524558..105ef55c32 100644 --- a/client/src/com/vaadin/client/debug/internal/LogSection.java +++ b/client/src/com/vaadin/client/debug/internal/LogSection.java @@ -15,9 +15,16 @@ */ package com.vaadin.client.debug.internal; +import java.util.logging.Formatter; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.logging.client.HtmlLogFormatter; import com.google.gwt.storage.client.Storage; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Timer; @@ -39,6 +46,50 @@ import com.vaadin.client.ValueMap; */ class LogSection implements Section { + private final class LogSectionHandler extends Handler { + private LogSectionHandler() { + setLevel(Level.ALL); + setFormatter(new HtmlLogFormatter(true) { + @Override + protected String getHtmlPrefix(LogRecord event) { + return ""; + } + + @Override + protected String getHtmlSuffix(LogRecord event) { + return ""; + } + + @Override + protected String getRecordInfo(LogRecord event, String newline) { + return ""; + } + }); + } + + @Override + public void publish(LogRecord record) { + if (!isLoggable(record)) { + return; + } + + Formatter formatter = getFormatter(); + String msg = formatter.format(record); + + addRow(record.getLevel(), msg); + } + + @Override + public void close() { + // Nothing to do + } + + @Override + public void flush() { + // Nothing todo + } + } + // If scroll is not locked, content will be scrolled after delay private static final int SCROLL_DELAY = 100; private Timer scrollTimer = null; @@ -112,6 +163,8 @@ class LogSection implements Section { } }); + // Add handler to the root logger + Logger.getLogger("").addHandler(new LogSectionHandler()); } /** @@ -262,20 +315,19 @@ class LogSection implements Section { * needed, and scrolls new row into view if scroll lock is not active. * * @param level - * @param category * @param msg * @return */ - private Element addRow(Level level, String category, String msg) { + private Element addRow(Level level, String msg) { int sinceReset = VDebugWindow.getMillisSinceReset(); int sinceStart = VDebugWindow.getMillisSinceStart(); Element row = DOM.createDiv(); row.addClassName(VDebugWindow.STYLENAME + "-row"); - row.addClassName(level.name()); + row.addClassName(level.getName()); String inner = "<span class='" + VDebugWindow.STYLENAME + "-" - + category + "'></span><span class='" + VDebugWindow.STYLENAME + + "'></span><span class='" + VDebugWindow.STYLENAME + "-time' title='" + VDebugWindow.getTimingTooltip(sinceStart, sinceReset) + "'>" + sinceReset + "ms</span><span class='" @@ -290,29 +342,14 @@ class LogSection implements Section { return row; } - /* - * LOGGING methods follow. - * - * NOTE that these are still subject to change. - */ - - @Override - public void log(Level level, String msg) { - addRow(level, "none", msg); - } - - public void log(Level level, String category, String msg) { - addRow(level, category, msg); - } - @Override public void meta(ApplicationConnection ac, ValueMap meta) { - log(Level.DEBUG, "Meta: " + meta.toSource()); + addRow(Level.FINE, "Meta: " + meta.toSource()); } @Override public void uidl(ApplicationConnection ac, ValueMap uidl) { - log(Level.DEBUG, "UIDL: " + uidl.toSource()); + addRow(Level.FINE, "UIDL: " + uidl.toSource()); } }
\ No newline at end of file diff --git a/client/src/com/vaadin/client/debug/internal/NetworkSection.java b/client/src/com/vaadin/client/debug/internal/NetworkSection.java index ebdeff810f..e94791ce1f 100644 --- a/client/src/com/vaadin/client/debug/internal/NetworkSection.java +++ b/client/src/com/vaadin/client/debug/internal/NetworkSection.java @@ -68,11 +68,6 @@ public class NetworkSection implements Section { } @Override - public void log(Level level, String msg) { - // NOP - } - - @Override public void meta(ApplicationConnection ac, ValueMap meta) { // NOP } diff --git a/client/src/com/vaadin/client/debug/internal/Section.java b/client/src/com/vaadin/client/debug/internal/Section.java index 7c662bc035..c6b8af55e8 100644 --- a/client/src/com/vaadin/client/debug/internal/Section.java +++ b/client/src/com/vaadin/client/debug/internal/Section.java @@ -70,8 +70,6 @@ public interface Section { */ public void hide(); - public void log(Level level, String msg); - public void meta(ApplicationConnection ac, ValueMap meta); public void uidl(ApplicationConnection ac, ValueMap uidl); diff --git a/client/src/com/vaadin/client/debug/internal/VDebugWindow.java b/client/src/com/vaadin/client/debug/internal/VDebugWindow.java index 86de1884ef..a7e22420b7 100644 --- a/client/src/com/vaadin/client/debug/internal/VDebugWindow.java +++ b/client/src/com/vaadin/client/debug/internal/VDebugWindow.java @@ -684,30 +684,6 @@ public final class VDebugWindow extends VOverlay { }); } - /* - * LOGGING methods follow - * - * NOTE that these are subject to change and only implemented in the current - * manner for compatibility. - * - * TODO Sections should listen to logging events in the future - */ - - /** - * Called when a generic logging message is received - * - * @param level - * @param msg - */ - void log(Level level, String msg) { - if (isClosed()) { - return; - } - for (Section s : sections) { - s.log(level, msg); - } - } - /** * Called when the result from analyzeLayouts is received. * |