001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.classic.boolex;
015
016import ch.qos.logback.classic.Level;
017import ch.qos.logback.classic.spi.ILoggingEvent;
018import ch.qos.logback.core.boolex.EvaluationException;
019import ch.qos.logback.core.boolex.EventEvaluatorBase;
020
021/**
022 * Evaluates to true when the logging event passed as parameter has level ERROR
023 * or higher.
024 * 
025 * @author Ceki Gülcü
026 * 
027 */
028public class OnErrorEvaluator extends EventEvaluatorBase<ILoggingEvent> {
029
030    /**
031     * Return true if event passed as parameter has level ERROR or higher, returns
032     * false otherwise.
033     */
034    public boolean evaluate(ILoggingEvent event) throws NullPointerException, EvaluationException {
035        return event.getLevel().levelInt >= Level.ERROR_INT;
036    }
037}