private static boolean shouldLogPhases() { return LOG_PHASES.isLoggable(Level.FINER); }
private static boolean shouldLogCompilationTime() { return LOG_TOTAL_COMPILATION_TIME.isLoggable(Level.FINE); }
/** * Logs a message with single parameter. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param message the message to log * @param parameter the log message parameter * @since 1.0 */ public void log(final Level level, final String message, final Object parameter) { if (!isLoggable(level)) { return; } doLog(level, message, null, null, parameter); }
/** * Logs a message. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param message the message to log * @since 1.0 */ public void log(final Level level, final String message) { if (!isLoggable(level)) { return; } doLog(level, message, null, null, (Object) null); }
/** * Logs a message with multiple parameters. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param message the message to log * @param parameters the log message parameters * @since 1.0 */ public void log(final Level level, final String message, final Object[] parameters) { if (!isLoggable(level)) { return; } doLog(level, message, null, null, parameters); }
/** * Logs a message, specifying source class and source method. The message is constructed only * when the logger is enabled for the given {@code level}. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param sourceClass the class issued the logging request * @param sourceMethod the method issued the logging request * @param messageSupplier the {@link Supplier} called to produce the message to log * @since 1.0 */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final Supplier<String> messageSupplier) { if (!isLoggable(level)) { return; } doLog(level, messageSupplier, sourceClass, sourceMethod, (Object) null); }
/** * Logs a message with single parameter, specifying source class and source method. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param sourceClass the class issued the logging request * @param sourceMethod the method issued the logging request * @param message the message to log * @param parameter the log message parameter * @since 1.0 */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String message, final Object parameter) { if (!isLoggable(level)) { return; } doLog(level, message, sourceClass, sourceMethod, parameter); }
/** * Logs a message, specifying source class and source method. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param sourceClass the class issued the logging request * @param sourceMethod the method issued the logging request * @param message the message to log * @since 1.0 */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String message) { if (!isLoggable(level)) { return; } doLog(level, message, sourceClass, sourceMethod, (Object) null); }
/** * Log a message with multiple parameters, specifying source class and source method. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param sourceClass the class issued the logging request * @param sourceMethod the method issued the logging request * @param message the message to log * @param parameters the log message parameters * @since 1.0 */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String message, Object[] parameters) { if (!isLoggable(level)) { return; } doLog(level, message, sourceClass, sourceMethod, parameters); }
/** * Logs a message. The message is constructed only when the logger is enabled for the given * {@code level}. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param messageSupplier the {@link Supplier} called to produce the message to log * @since 1.0 */ public void log(final Level level, final Supplier<String> messageSupplier) { if (!isLoggable(level)) { return; } doLog(level, messageSupplier, null, null, (Object) null); }
/** * Logs a message with an exception. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param message the message to log * @param thrown the exception to log * @since 1.0 */ public void log(final Level level, final String message, final Throwable thrown) { if (!isLoggable(level)) { return; } doLog(level, message, null, null, thrown); }
/** * Logs a message with an exception, specifying source class and source method. The message is * constructed only when the logger is enabled for the given {@code level}. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param sourceClass the class issued the logging request * @param sourceMethod the method issued the logging request * @param thrown the exception to log * @param messageSupplier the {@link Supplier} called to produce the message to log * @since 1.0 */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final Throwable thrown, final Supplier<String> messageSupplier) { if (!isLoggable(level)) { return; } doLog(level, messageSupplier, sourceClass, sourceMethod, thrown); }
/** * Logs a message with an exception. The message is constructed only when the logger is enabled * for the given {@code level}. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param thrown the exception to log * @param messageSupplier the {@link Supplier} called to produce the message to log * @since 1.0 */ public void log(final Level level, final Throwable thrown, final Supplier<String> messageSupplier) { if (!isLoggable(level)) { return; } doLog(level, messageSupplier, null, null, thrown); }
/** * Logs a message with an exception, specifying source class and source method. * <p> * If the logger is enabled for the given {@code level} the message is sent to the * {@link Handler} registered in the current {@link Context}. * * @param level the required {@link Level} * @param sourceClass the class issued the logging request * @param sourceMethod the method issued the logging request * @param message the message to log * @param thrown the exception to log * @since 1.0 */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String message, final Throwable thrown) { if (!isLoggable(level)) { return; } doLog(level, message, sourceClass, sourceMethod, thrown); }
synchronized boolean isLoggable(final String loggerName, final Object currentContext, final Level level) { final Set<String> toRemove = collectRemovedLevels(); if (!toRemove.isEmpty()) { reconfigure(Collections.emptyMap(), toRemove); // Logger's effective level may changed return getLogger(loggerName).isLoggable(level); } final Map<String, Level> current = TruffleLanguage.AccessAPI.engineAccess().getLogLevels(currentContext); if (current.isEmpty()) { final int currentLevel = DEFAULT_VALUE; return level.intValue() >= currentLevel && currentLevel != OFF_VALUE; } if (activeContexts.size() == 1) { return true; } final int currentLevel = computeLevel(loggerName, current); return level.intValue() >= currentLevel && currentLevel != OFF_VALUE; }
/** * Logs entry into method with multiple parameters. * <p> * This method can be used to log entry into a method. A {@link LogRecord} with message "ENTRY", * the given {@code sourceMethod} and {@code sourceClass} and given parameters is logged with * {@link Level#FINER finer level}. * * @param sourceClass the entered class * @param sourceMethod the entered method * @param parameters the method parameters * @since 1.0 */ public void entering(final String sourceClass, final String sourceMethod, final Object[] parameters) { String msg = "ENTRY"; if (parameters == null) { logp(Level.FINER, sourceClass, sourceMethod, msg); return; } if (!isLoggable(Level.FINER)) { return; } for (int i = 0; i < parameters.length; i++) { msg = msg + " {" + i + "}"; } logp(Level.FINER, sourceClass, sourceMethod, msg, parameters); }