All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliasi.io.LogLevel Maven / Gradle / Ivy

Go to download

This is the original Lingpipe: http://alias-i.com/lingpipe/web/download.html There were not made any changes to the source code.

There is a newer version: 4.1.2-JL1.0
Show newest version
/*
 * LingPipe v. 4.1.0
 * Copyright (C) 2003-2011 Alias-i
 *
 * This program is licensed under the Alias-i Royalty Free License
 * Version 1 WITHOUT ANY WARRANTY, without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the Alias-i
 * Royalty Free License Version 1 for more details.
 *
 * You should have received a copy of the Alias-i Royalty Free License
 * Version 1 along with this program; if not, visit
 * http://alias-i.com/lingpipe/licenses/lingpipe-license-1.txt or contact
 * Alias-i, Inc. at 181 North 11th Street, Suite 401, Brooklyn, NY 11211,
 * +1 (718) 290-9170.
 */

package com.aliasi.io;


import java.util.Comparator;

/**
 * A {@code LogLevel} is used to indicate a severity level for selecting
 * which logging messages to report.   
 *
 * 

The static singleton comparator {@link #COMPARATOR} may be used * to compare severity levels. * *

Unlike other commonly used logging packages (e.g. Java Logging, * Log4J, Jakarta Commons Logging), this logging package is completely * configuration free in the sense that it is configured entirely * through the API. * *

Each logging level has an integer severity level. A {@link * Reporter} will report messages that are at or above its specified * level. * *

The logging levels in increasing order of severity are: * *

    *
  • {@link LogLevel#TRACE}: Verbose debugging. *
  • {@link LogLevel#DEBUG}: Fine-grained debugging. *
  • {@link LogLevel#INFO}: Coarse-grained application flow. *
  • {@link LogLevel#WARN}: Potentially harmful situation. *
  • {@link LogLevel#ERROR}: Potentially recoverable error. *
  • {@link LogLevel#FATAL}: Unrecoverable error. *
* *

There are also two special levels which bound the regular severity * levels. * *

    *
  • {@link LogLevel#ALL} : Report all log messages. Highest possible severity. *
  • {@link LogLevel#NONE}: Report no log messages. Lowest possible severity. *
* *

The levels were chosen to follow the most popular loggers * for Java: * *

* * @author Bob Carpenter * @version 3.8 * @since Lingpipe3.8 */ public enum LogLevel { /** * Special level with lowest possible severity. */ ALL(Integer.MIN_VALUE), /** * Very detailed debugging information. */ TRACE(0), /** * Fine-grained debugging. */ DEBUG(1), /** * Coarse-grained application flow information. */ INFO(2), /** * Possibly harmful situation . */ WARN(3), /** * Error that may be recoverable. */ ERROR(4), /** * Unrecoverable error. */ FATAL(5), /** * Special severity with level higher than all other levels. */ NONE(Integer.MAX_VALUE); int mSeverity; LogLevel(int severity) { mSeverity = severity; } /** * Returns a comparator that compares levels by severity. If * {@code level1} is more severe than {@code level2}, {@code * LogLevel.COMPARATOR.compare(level1,level2)} returns {@code 1}, * if {@code level1} is less severe than {@code level2}, it * returns {@code -1}, and if they are equally severe, it returns * {@code 0}. */ public static final Comparator COMPARATOR = new Comparator() { public int compare(LogLevel level1, LogLevel level2) { return level1.mSeverity > level2.mSeverity ? 1 : ( level1.mSeverity < level2.mSeverity ? -1 : 0 ); } }; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy