@Override protected boolean matchesSafely(Event item, Description mismatchDescription) { return level.equals(item.getLevel().getLevel()); }
/** * Matches events which have any of the specified {@link EventLevel levels}. If no levels are provided, the * predicate will always return {@code false}. * * @param levels the levels to compare against * @return a {@code Predicate} which returns {@code true} for {@link Event events} with one of the specified * levels, and {@code false} for all others */ @Nonnull public static Predicate<Event> level(EventLevel... levels) { requireNonNull(levels, "levels"); if (levels.length == 0) { //Shortcut: If no levels were specified, Set.contains will never be true return event -> false; } Set<EventLevel> acceptedLevels = ImmutableSet.copyOf(levels); return event -> acceptedLevels.contains(event.getLevel()); }
/** * We go through all the johnson events and see if we find any ERROR or FATAL message. * * @return true if the server is reporting errors, false if not */ public boolean hasErrors() { final JohnsonEventContainer johnsonEventContainer = getJohnsonContainer(); if (johnsonEventContainer != null && johnsonEventContainer.hasEvents()) { final Collection<Event> events = johnsonEventContainer.getEvents(); for (Event event : events) { if (event.getLevel() != null) { final String level = event.getLevel().getLevel(); if (EventLevel.ERROR.equals(level) || EventLevel.FATAL.equals(level)) { return true; } } } } return false; }
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Event)) { return false; } Event e = (Event) o; return Objects.equals(getDate(), e.getDate()) && Objects.equals(getDesc(), e.getDesc()) && Objects.equals(getException(), e.getException()) && Objects.equals(getKey(), e.getKey()) && Objects.equals(getLevel(), e.getLevel()); }
public int hashCode() { return Objects.hash(getKey(), getDesc(), getException(), getLevel(), getDate()); }
LOG.debug("Searching Johnson for previous {} errors", EventLevel.FATAL); for (Event event : container.getEvents()) { EventLevel level = event.getLevel(); if (EventLevel.FATAL.equals(level.getLevel())) { LOG.error("Bypassing Spring ApplicationContext initialisation; a previous {} error was found: {}",
String message = "SpringMVC dispatcher [" + getServletName() + "] will not be started because the Spring WebApplicationContext failed to start"; container.addEvent(new Event(EventType.get(eventType), message, event.getLevel()));