Example usage for java.util.logging Logger isLoggable

List of usage examples for java.util.logging Logger isLoggable

Introduction

In this page you can find the example usage for java.util.logging Logger isLoggable.

Prototype

public boolean isLoggable(Level level) 

Source Link

Document

Check if a message of the given level would actually be logged by this logger.

Usage

From source file:pcgen.util.Logging.java

/**
 * Beep and print error message if PCGen is debugging.
 *
 * @param s String error message/*w  ww.  j a  v  a2 s .co  m*/
 * @param context the LoadContext containing the deprecated resource 
 */
public static void deprecationPrint(final String s, final LoadContext context) {
    if (debugMode) {
        S_TOOLKIT.beep();
    }

    Logger l = getLogger();
    if (l.isLoggable(LST_WARNING) && SettingsHandler.outputDeprecationMessages()) {
        if (context != null && context.getSourceURI() != null) {
            l.log(LST_WARNING, s + " (Source: " + context.getSourceURI() + " )");
        } else {
            l.log(LST_WARNING, s);
        }
    }
}

From source file:pcgen.util.Logging.java

/**
 * Report where an issue was encountered.
 *
 * @param context the LoadContext containing the resource 
 *//* w  ww . jav  a  2  s. c  o  m*/
public static void reportSource(final Level lvl, final LoadContext context) {
    Logger l = getLogger();
    if (l.isLoggable(lvl)) {
        if (context != null && context.getSourceURI() != null) {
            l.log(lvl, " (Source: " + context.getSourceURI() + " )");
        } else {
            l.log(lvl, " (Source unknown)");
        }
    }
}

From source file:pcgen.util.Logging.java

/**
 * Report where an issue was encountered.
 *
 * @param sourceUri the source containing the resource 
 *//*from  www.j  a va  2  s .  c o  m*/
public static void reportSource(final Level lvl, final URI sourceUri) {
    Logger l = getLogger();
    if (l.isLoggable(lvl)) {
        if (sourceUri != null) {
            l.log(lvl, " (Source: " + sourceUri + ')');
        } else {
            l.log(lvl, " (Source unknown)");
        }
    }
}

From source file:pcgen.util.Logging.java

/**
 * Beep and print error message if PCGen is debugging.
 *
 * @param s String error message/*  w w w . java  2  s.c o  m*/
 */
public static void errorPrint(final String s) {
    if (debugMode) {
        S_TOOLKIT.beep();
    }

    Logger l = getLogger();
    if (l.isLoggable(ERROR)) {
        l.log(ERROR, s);
    }
}

From source file:pcgen.util.Logging.java

/**
 * Beep and print error message if PCGen is debugging.
 *
 * @param s String error message/*  w ww.j av  a  2 s  .  c o  m*/
 * @param params Varargs list of parameters for substitution into the 
 * error message.
 */
public static void errorPrint(final String s, final Object... params) {
    if (debugMode) {
        S_TOOLKIT.beep();
    }

    Logger l = getLogger();
    if (l.isLoggable(ERROR)) {
        l.log(ERROR, s, params);
    }
}

From source file:pcgen.util.Logging.java

/**
 * Beep and print error message if PCGen is debugging.
 *
 * @param s String error message/*from   ww w.j  a  va2  s  .co  m*/
 * @param context the LoadContext containing the deprecated resource
 */
public static void errorPrint(final String s, final LoadContext context) {
    if (debugMode) {
        S_TOOLKIT.beep();
    }

    Logger l = getLogger();
    if (l.isLoggable(ERROR)) {
        if (context != null && context.getSourceURI() != null) {
            l.log(ERROR, s + " (Source: " + context.getSourceURI() + " )");
        } else {
            l.log(ERROR, s);
        }
    }
}

From source file:pcgen.util.Logging.java

/**
 * Beep and print error message if PCGen is debugging.
 *
 * @param s String error message/*www .  j  av a 2 s . co m*/
 * @param sourceURI the source containing the resource in error
 */
public static void errorPrint(final String s, final URI sourceURI) {
    if (debugMode) {
        S_TOOLKIT.beep();
    }

    Logger l = getLogger();
    if (l.isLoggable(ERROR)) {
        if (sourceURI != null) {
            l.log(ERROR, s + " (Source: " + sourceURI + " )");
        } else {
            l.log(ERROR, s);
        }
    }
}

From source file:pcgen.util.Logging.java

/**
 * Log a message, if logging is enabled at the
 * supplied level of detail. // w w w  .  j  a  v a  2 s  .co m
 * 
 * @param lvl The detail level of the message
 * @param msg String message
 */
public static void log(final Level lvl, final String msg) {
    Logger l = getLogger();
    if (l.isLoggable(lvl)) {
        l.log(lvl, msg);
    }
}

From source file:pcgen.util.Logging.java

/**
 * Log a message with a stack trace, if logging is enabled at the
 * supplied level of detail. /*from   ww w  .j  a  va2  s  .c  o m*/
 * 
 * @param lvl The detail level of the message
 * @param msg String message
 * @param thr Throwable stack frame
 */
public static void log(final Level lvl, final String msg, final Throwable thr) {
    Logger l = getLogger();
    if (l.isLoggable(lvl)) {
        l.log(lvl, msg, thr);
    }
}

From source file:pcgen.util.Logging.java

/**
 * Log a message with a stack trace, if logging is enabled at the
 * supplied level of detail. //from  w ww.  java2 s . co m
 * This is mainly for use with the pcgen.rules.persistence.token.ParseResult class.
 * 
 * @param lvl        The detail level of the message
 * @param msg        String message
 * @param stackTrace The stack trace
 */
public static void log(Level lvl, String msg, StackTraceElement[] stackTrace) {
    Logger l = getLogger();
    if (l.isLoggable(lvl)) {
        l.log(lvl, msg, stackTrace);
    }
}