Dear Sir,
I beg your pardon since I'm not yet acquainted with the procedures for 
patching gwt, so I post here my proposal, hoping that someone with enough 
rights can place it in the next release.

The file:

user/src/com/google/gwt/logging/client/ConsoleLogHandler.java
has a minor flaws in the console logging.

Most browser now have a 4 levels filter (ERRORS, WARNING, INFO and VERBOSE),
but the ConsoleLogHandler.publish() method logs level lower than info using 
the console.log method()

// ---------- CODE BEGIN ---------------------
  @Override
  public void publish(LogRecord record) {
    if (!isSupported() || !isLoggable(record)) {
      return;
    }
    String msg = getFormatter().format(record);
    int val = record.getLevel().intValue();
    if (val >= Level.SEVERE.intValue()) {
      error(msg);
    } else if (val >= Level.WARNING.intValue()) {
      warn(msg);
    } else if (val >= Level.INFO.intValue()) {
      info(msg);
    } else {
      log(msg);
    }
  }

  private native boolean isSupported() /*-{
    return !!window.console;
  }-*/;

  private native void error(String message) /*-{
    window.console.error(message);
  }-*/;

  private native void warn(String message) /*-{
    window.console.warn(message);
  }-*/;

  private native void info(String message) /*-{
    window.console.info(message);
  }-*/;

  private native void log(String message) /*-{
*    window.console.log(message);*
  }-*/;

// ---------- CODE END ---------------------

This is a mistake, since the console.log() and the console.info() methods 
are both logging at INFO level. This way the "verbose" filter of the 
console is unuseful.

The solution is to replace the console.log() method with the 
console.debug() method, that is:

  private native void log(String message) /*-{
*    window.console.debug(message);*
  }-*/;

(May be better also to rename the method from "  private native void 
log(String message)" to "  private native void verbose(String message)" to 
make it more explicit.

Please let me know if I my proposal can be accepted or I need to do 
something else.

Thanks a lot,
Luca





-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/a88b38a3-9075-4ca4-a622-f3d957539669n%40googlegroups.com.

Reply via email to