A valid reason is : "Because the client asked" :-)
I managed to sort this out for myself. In case anyone is interested in this.
What you have to do is create a "super" directory. This on the same level as the "client" directory of your module.
In this directory you create a java.util.logging.Level class with the same content as the one found in the GWT source. But with the added level.
For example :
/* * Copyright 2010 Google Inc. * * 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 java.util.logging; import com.google.gwt.core.shared.GWT; import com.google.gwt.logging.impl.LevelImpl; import com.google.gwt.logging.impl.LevelImplNull; import java.io.Serializable; /** * An emulation of the java.util.logging.Level class. See * <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Level.html"> * The Java API doc for details</a> */ public class Level implements Serializable { private static LevelImpl staticImpl = GWT.create(LevelImplNull.class); public static Level ALL = new LevelAll(); public static Level CONFIG = new LevelConfig(); public static Level FINE = new LevelFine(); public static Level FINER = new LevelFiner(); public static Level FINEST = new LevelFinest(); public static Level INFO = new LevelInfo(); public static Level OFF = new LevelOff(); public static Level EXCEPTION = new LevelException(); public static Level WARNING = new LevelWarning(); public static Level ERROR = new LevelError(); public static Level SEVERE = new LevelSevere(); private static class LevelAll extends Level { @Override public String getName() { return "ALL"; } @Override public int intValue() { return Integer.MIN_VALUE; } } private static class LevelConfig extends Level { @Override public String getName() { return "CONFIG"; } @Override public int intValue() { return 700; } } private static class LevelFine extends Level { @Override public String getName() { return "FINE"; } @Override public int intValue() { return 500; } } private static class LevelFiner extends Level { @Override public String getName() { return "FINER"; } @Override public int intValue() { return 400; } } private static class LevelFinest extends Level { @Override public String getName() { return "FINEST"; } @Override public int intValue() { return 300; } } private static class LevelInfo extends Level { @Override public String getName() { return "INFO"; } @Override public int intValue() { return 800; } } private static class LevelOff extends Level { @Override public String getName() { return "OFF"; } @Override public int intValue() { return Integer.MAX_VALUE; } } private static class LevelException extends Level { @Override public String getName() { return "EXCEPTION"; } @Override public int intValue() { return 1000; } } private static class LevelSevere extends Level { @Override public String getName() { return "SEVERE"; } @Override public int intValue() { return 1000; } } private static class LevelError extends Level { @Override public String getName() { return "ERROR"; } @Override public int intValue() { return 950; } } private static class LevelWarning extends Level { @Override public String getName() { return "WARNING"; } @Override public int intValue() { return 900; } } public static Level parse(String name) { return staticImpl.parse(name); } protected Level() { } public String getName() { return "DUMMY"; } public int intValue() { return -1; } @Override public String toString() { return getName(); } /* Not Implemented */ // public boolean equals(Object ox) {} // protected Level(String name, int value, String resourceBundleName) {} // public String getLocalizedName() {} // public String getResourceBundleName() {} // public int hashCode() {} } Now you must mark this "super" directory as super source in your gwt.xml
<super-source path="super"/> If you are using Eclipse you will have to exclude this super directory from the source path to avoid eclipse giving errors. And add it again as a seperate source path so that eclipse does check the file for errors.
Finally, if you do all this in a sub-module, you must ensure that when compiling your main module, this gets priority over the classes in rt.jar. This can be done by using an endorsed directory when compiling.
Op woensdag 14 oktober 2015 12:26:39 UTC+2 schreef Jens:
Say I want an extra level between SEVERE (1000), and warning (900) --> ERROR (950).
How can I achieve this ?You would need to patch GWTs java.util.logging emulation to support that. If you just want to do it for one project then you can probably copy the emulated files of GWT into that project and modify them accordingly. You would also need to adjust LogImpl.gwt.xml and LoggingDisabled.gwt.xml.But IMHO there is no real value in adding a level between SEVERE and WARNING that is called ERROR. What would be the difference between SEVERE and ERROR? The name ERROR already implies that it must always be severe otherwise it wouldn't be an error.-- J.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment