/* @VaadinApache2LicenseForJavaFiles@ */ package com.vaadin.terminal.gwt.client; import java.util.Set; import com.google.gwt.core.client.GWT; /** * A helper class to do some client side logging. *

* This class replaces previously used loggin style: * ApplicationConnection.getConsole().log("foo"). *

* The default widgetset provides three modes for debugging: *

*

* Implementations can be customized with GWT deferred binding by overriding * NullConsole.class or VDebugConsole.class. This way developer can for example * build mechanism to send client side logging data to a server. *

* Note that logging in client side is not fully optimized away even in * production mode. Use logging moderately in production code to keep the size * of client side engine small. An exception is {@link GWT#log(String)} style * logging, which is available only in GWT development mode, but optimized away * when compiled to web mode. * * * TODO improve javadocs of individual methods * */ public class VConsole { private static Console impl; /** * Used by ApplicationConfiguration to initialize VConsole. * * @param console */ static void setImplementation(Console console) { impl = console; } /** * Used by ApplicationConnection to support deprecated getConsole() api. */ static Console getImplementation() { return impl; } public static void log(String msg) { if (impl != null) { impl.log(msg); } } public static void log(Throwable e) { if (impl != null) { impl.log(e); } } public static void error(Throwable e) { if (impl != null) { impl.error(e); } } public static void error(String msg) { if (impl != null) { impl.error(msg); } } public static void printObject(Object msg) { if (impl != null) { impl.printObject(msg); } } public static void dirUIDL(ValueMap u, ApplicationConfiguration cnf) { if (impl != null) { impl.dirUIDL(u, cnf); } } public static void printLayoutProblems(ValueMap meta, ApplicationConnection applicationConnection, Set zeroHeightComponents, Set zeroWidthComponents) { if (impl != null) { impl.printLayoutProblems(meta, applicationConnection, zeroHeightComponents, zeroWidthComponents); } } }