Java Code Examples for com.google.gwt.core.ext.TreeLogger#Type
The following examples show how to use
com.google.gwt.core.ext.TreeLogger#Type .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LaunchConfiguration.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public String getNeedsAttentionLevel() { TreeLogger.Type maxNeedsAttentionLevel = null; synchronized (privateInstanceLock) { List<IModelNode> allChildren = new ArrayList<IModelNode>(); allChildren.addAll(browserTabs); if (server != null) { allChildren.add(server); } for (IModelNode child : allChildren) { TreeLogger.Type childAttentionLevel = null; if (child.getNeedsAttentionLevel() != null) { childAttentionLevel = LogEntry.toTreeLoggerType(child.getNeedsAttentionLevel()); } if (childAttentionLevel == null) { continue; } if (maxNeedsAttentionLevel == null || maxNeedsAttentionLevel.isLowerPriorityThan(childAttentionLevel)) { maxNeedsAttentionLevel = childAttentionLevel; } } } if (maxNeedsAttentionLevel == null) { return null; } return maxNeedsAttentionLevel.getLabel(); }
Example 2
Source File: LogEntry.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * Returns the {@link TreeLogger.Type} enum value corresponding to the * <code>treeLoggerTypeName</code> or null if there isn't one. */ public static TreeLogger.Type toTreeLoggerType(String treeLoggerTypeName) { assert (treeLoggerTypeName != null); try { return TreeLogger.Type.valueOf(treeLoggerTypeName); } catch (IllegalArgumentException e) { // Ignored } return null; }
Example 3
Source File: LogEntry.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private boolean shouldPropageLogLevelToParent(Data parentLogData, Data childLogData) { TreeLogger.Type parentLogLevel = toTreeLoggerType(parentLogData.logLevel); TreeLogger.Type childLogLevel = toTreeLoggerType(childLogData.logLevel); return parentLogLevel == null || childLogLevel == null || parentLogLevel.isLowerPriorityThan(childLogLevel); }
Example 4
Source File: UnitTestTreeLogger.java From mvp4g with Apache License 2.0 | 5 votes |
public UnitTestTreeLogger(List<LogEntry> expectedEntries, EnumSet<TreeLogger.Type> loggableTypes) { this.expectedEntries.addAll(expectedEntries); this.loggableTypes = loggableTypes; // Sanity check that all expected entries are actually loggable. for (LogEntry entry : expectedEntries) { Type type = entry.getType(); Assert.assertTrue("Cannot expect an entry of a non-loggable type!", isLoggable(type)); loggableTypes.add(type); } }
Example 5
Source File: UnitTestTreeLogger.java From mvp4g with Apache License 2.0 | 5 votes |
public void expect(TreeLogger.Type type, String msg, Class<? extends Throwable> caught) { expected.add(new LogEntry(type, msg, caught)); }
Example 6
Source File: UnitTestTreeLogger.java From mvp4g with Apache License 2.0 | 5 votes |
/** * Sets the loggable types based on a lowest log level. */ public void setLowestLogLevel(TreeLogger.Type lowestLogLevel) { loggableTypes.clear(); for (Type type : TreeLogger.Type.values()) { if (!type.isLowerPriorityThan(lowestLogLevel)) { loggableTypes.add(type); } } }
Example 7
Source File: UnitTestTreeLogger.java From mvp4g with Apache License 2.0 | 5 votes |
public LogEntry(TreeLogger.Type type, String msg, Class<? extends Throwable> caught) { assert (type != null); this.type = type; this.msg = msg; this.caught = caught; }
Example 8
Source File: GwtProblemsTreeLogger.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
@Override public TreeLogger branch(TreeLogger.Type type, String msg, Throwable caught, HelpInfo helpInfo) { return this; }
Example 9
Source File: GwtProblemsTreeLogger.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
@Override public boolean isLoggable(TreeLogger.Type type) { return (!type.isLowerPriorityThan(TreeLogger.WARN)); }
Example 10
Source File: AttentionLevelUtils.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
/** * Determine whether or not the new attention level is more important than the * old attention level. The level typically corresponds to one of the * {@link com.google.gwt.core.ext.TreeLogger.Type} values. * * The new level will be deemed to be more important if: * * 1) <code>newAttentionLevel</code> is non-null and * <code>oldAttentionLevel</code> is null * * 2) <code>newAttentionLevel</code> is non-null and * <code>oldAttentionLevel</code> is a lower priority than * <code>newAttentionLevel</code>. * * 3) <code>newAttentionLevel</code> is null and the * <code>oldAttentionLevel</code> is non-null * * @param oldAttentionLevel the old attention level * @param newAttentionLevel the new attention level * * @return true if <code>newAttentionLevel</code> is more important than * <code>oldAttentionLevel</code>, false otherwise */ public static boolean isNewAttnLevelMoreImportantThanOldAttnLevel( String oldAttentionLevel, String newAttentionLevel) { if (oldAttentionLevel == newAttentionLevel) { // The two attention levels are equal; the new attention level is // not more important than the old attention level return false; } // If the two attention levels are non-null, check to see if // they're identical, or if the new level is a lower priority // than the old level. In either case, the new level is not // more important than the old level. if (oldAttentionLevel != null && newAttentionLevel != null) { if (oldAttentionLevel.equals(newAttentionLevel)) { // The attention levels are identical return false; } TreeLogger.Type oldLevel = LogEntry.toTreeLoggerType(oldAttentionLevel); TreeLogger.Type newLevel = LogEntry.toTreeLoggerType(newAttentionLevel); if (oldLevel == null || newLevel == null) { // Can't decipher the TreeLogger levels for either the old or new // attention levels; assume that the new level is not more important // the old level return false; } if (newLevel.isLowerPriorityThan(oldLevel)) { // The new level is at a lower level than the current level return false; } } /* * If we've reached this point, it is either the case that newAttentionLevel * is higher priority than oldAttentionLevel, or only one of * newAttentionLevel or oldAttentionLevel is null. In any of these cases, * the new level is more important than the old level. */ return true; }
Example 11
Source File: Log.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
private LogEntry<T> getFirstDeeplyNestedChildWithMaxAttnRecurse( List<LogEntry<T>> logEntries) { LogEntry<T> maxEntryNeedsAttn = null; TreeLogger.Type maxEntryAttnLevel = null; for (LogEntry<T> child : logEntries) { /* * Determine the child's attention level. * * TODO: It is somewhat confusing that getAttentionLevel() is null for * those entries that are marked as needsAttention. Perhaps if an entry * needs attention, we could also set it's attention level. That would * avoid the need for this conditional below. */ TreeLogger.Type childAttnLevel = null; if (child.getLogData().getNeedsAttention()) { childAttnLevel = LogEntry.toTreeLoggerType(child.getLogData().getLogLevel()); } else if (child.getLogData().getAttentionLevel() != null) { childAttnLevel = LogEntry.toTreeLoggerType(child.getLogData().getAttentionLevel()); } if (childAttnLevel == null) { continue; } if (maxEntryNeedsAttn == null || maxEntryAttnLevel.isLowerPriorityThan(childAttnLevel)) { maxEntryNeedsAttn = child; maxEntryAttnLevel = childAttnLevel; /* * TODO: Optimization - once you find a node that has an attention level * of ERROR, you can break out of the loop. However, this presumes that * we know what the highest attention level is. As it is written right * now, the attention levels could be re-ordered and this algorithm * would still work. */ } } if (maxEntryNeedsAttn == null) { return null; } LogEntry<T> childOfMaxEntryNeedsAttn = getFirstDeeplyNestedChildWithMaxAttnRecurse(maxEntryNeedsAttn.getDisclosedChildren()); if (childOfMaxEntryNeedsAttn == null) { return maxEntryNeedsAttn; } // Always favor the child, since we're going for the deepest nesting return childOfMaxEntryNeedsAttn; }
Example 12
Source File: UnitTestTreeLogger.java From mvp4g with Apache License 2.0 | 4 votes |
/** * Sets the loggable types based on an explicit set. */ public void setLoggableTypes(EnumSet<TreeLogger.Type> loggableTypes) { this.loggableTypes = loggableTypes; }