Class Console

java.lang.Object
com.vaadin.client.Console

public final class Console extends Object
Helper class for using window.console. Does not log anything except JavaScript exception traces to console if production mode is enabled.
Since:
1.0
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    debug(Object message)
    If not in production mode, logs the given message to the browser console using the debug log level.
    static void
    error(Object message)
    If not in production mode, logs the given message to the browser console using the error log level.
    static void
    log(Object message)
    If not in production mode, logs the given message to the browser console using the info log level.
    static void
    Logs the stacktrace of an exception to the browser console.
    static void
    setProductionMode(boolean isProductionMode)
    Changes logger behavior, making it skip all browser logging for production mode.
    static void
    warn(Object message)
    If not in production mode, logs the given message to the browser console using the warning log level.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setProductionMode

      public static void setProductionMode(boolean isProductionMode)
      Changes logger behavior, making it skip all browser logging for production mode.
      Parameters:
      isProductionMode - if an application is in the production mode or not
    • debug

      public static void debug(Object message)
      If not in production mode, logs the given message to the browser console using the debug log level.

      If used directly in a JVM, writes the message to standard output disregarding of the production mode settings.

      Parameters:
      message - the message to log
    • log

      public static void log(Object message)
      If not in production mode, logs the given message to the browser console using the info log level.

      If used directly in a JVM, writes the message to standard output disregarding of the production mode settings.

      Parameters:
      message - the message to log
    • warn

      public static void warn(Object message)
      If not in production mode, logs the given message to the browser console using the warning log level.

      If used directly in a JVM, writes the message to standard error disregarding of the production mode settings.

      Parameters:
      message - the message to log
    • error

      public static void error(Object message)
      If not in production mode, logs the given message to the browser console using the error log level.

      If used directly in a JVM, writes the message to standard error disregarding of the production mode settings.

      Parameters:
      message - the message to log
    • reportStacktrace

      public static void reportStacktrace(Exception exception)
      Logs the stacktrace of an exception to the browser console. Logging is done asynchronously since that approach allows reporting it with highest possible fidelity.
      Parameters:
      exception - the exception for which