/** * Logs the given message and throwable to make it easier to trace the execution of the program. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void verbose(@Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.VERBOSE, message, throwable, arguments); }
/** * Logs the given message and throwable both to the console and the log file. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure @SuppressWarnings("CallToPrintStackTrace") public static void log(@Nonnull Level level, @Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(level, message, throwable, arguments); System.out.println(Strings.format(message, arguments)); if (throwable != null) { System.out.println(); throwable.printStackTrace(); System.out.println(); } }
/** * Logs the given message and throwable to help developers locate bugs in the code. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void debugging(@Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.DEBUGGING, message, throwable, arguments); }
/** * Logs the given message and throwable as a fatal error that prevents the thread or process from continuing. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void fatal(@Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.FATAL, message, throwable, arguments); }
/** * Logs the given message and throwable as an error from which the application can possibly recover. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void error(@Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.ERROR, message, throwable, arguments); }
/** * Logs the given message and throwable as a warning that indicate potential problems in the program. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void warning(@Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.WARNING, message, throwable, arguments); }
/** * Logs the given message and throwable to inform about important runtime events. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void information(@Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.INFORMATION, message, throwable, arguments); }
/** * Logs the given message and throwable if the configured filter accepts them. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void log(@Nonnull Level level, @Nonnull CharSequence message, @Nullable Throwable throwable, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { final @Nonnull LoggingFilter filter = LoggingFilter.filter.get(); if (filter.isPotentiallyLogged(level)) { final @Nonnull String caller = Caller.get(); final @Nonnull String thread = Thread.currentThread().getName(); final @Nonnull String originalMessage = message.toString(); final boolean addNoPeriod = originalMessage.endsWith(".") || originalMessage.endsWith(":") || originalMessage.endsWith("\n"); final @Nonnull String formattedMessage = Strings.format(originalMessage, arguments) + (addNoPeriod ? "" : "."); if (filter.isLogged(level, caller, thread, formattedMessage, throwable)) { logger.get().log(level, caller, thread, formattedMessage, throwable); } } }
/** * Logs the given message both to the console and the log file. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void log(@Nonnull Level level, @Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(level, message, null, arguments); System.out.println(Strings.format(message, arguments)); }
/** * Logs the given message to inform about important runtime events. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void information(@Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.INFORMATION, message, null, arguments); }
/** * Logs the given message to make it easier to trace the execution of the program. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void verbose(@Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.VERBOSE, message, null, arguments); }
/** * Logs the given message as an error from which the application can possibly recover. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void error(@Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.ERROR, message, null, arguments); }
/** * Logs the given message as a fatal error that prevents the thread or process from continuing. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void fatal(@Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.FATAL, message, null, arguments); }
/** * Logs the given message as a warning that indicate potential problems in the program. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void warning(@Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.WARNING, message, null, arguments); }
/** * Logs the given message to help developers locate bugs in the code. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure public static void debugging(@Nonnull CharSequence message, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(Level.DEBUGGING, message, null, arguments); }
/** * Logs the given message with the given position at the given level. * Each dollar sign in the message is replaced with the corresponding argument. */ @Impure protected static void log(@Nonnull Level level, @Nonnull CharSequence message, @Nullable SourcePosition position, @NonCaptured @Unmodified @Nonnull @NullableElements Object... arguments) { Logger.log(level, message + (position != null ? " " + position : ""), null, arguments); if (level.getValue() >= Level.INFORMATION.getValue() && StaticProcessingEnvironment.environment.isSet()) { if (position == null) { StaticProcessingEnvironment.environment.get().getMessager().printMessage(levelToKind.get(level), Strings.format(message, arguments)); } else if (position.getAnnotationValue() != null) { StaticProcessingEnvironment.environment.get().getMessager().printMessage(levelToKind.get(level), Strings.format(message, arguments), position.getElement(), position.getAnnotationMirror(), position.getAnnotationValue()); } else if (position.getAnnotationMirror() != null) { StaticProcessingEnvironment.environment.get().getMessager().printMessage(levelToKind.get(level), Strings.format(message, arguments), position.getElement(), position.getAnnotationMirror()); } else { StaticProcessingEnvironment.environment.get().getMessager().printMessage(levelToKind.get(level), Strings.format(message, arguments), position.getElement()); } } }