Class LogUtils

java.lang.Object
io.gitlab.ntduycse.util.LogUtils

public final class LogUtils extends Object
Logging helpers that enforce a consistent [Spring] prefix and SLF4J-style placeholders. Callers should route every Spring Quickstart log line through these helpers instead of calling the underlying Gradle Logger directly, so the prefix stays in exactly one place.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Single source of truth for the prefix added to every Spring Quickstart log line.
    static final String
    Gradle project property that toggles verbose output without editing the build script.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    detail(org.gradle.api.logging.Logger logger, boolean verbose, String pattern, Object... args)
    Detail line: lifecycle when verbose=true, info otherwise.
    static void
    header(org.gradle.api.logging.Logger logger, String pattern, Object... args)
    Section header: emits a blank line followed by [Spring] <pattern> at lifecycle level.
    static boolean
    isVerbose(org.gradle.api.Project project, SpringQuickstartExtension extension)
    Resolves the effective verbose flag: the Gradle project property "spring.verbose" wins when set, otherwise the extension default (SpringQuickstartExtension.getVerbose()) is used.
    static void
    logDependencies(boolean verbose, List<PluginDependency>... dependencies)
    Logs a grouped, aligned "dependencies:" block at detail verbosity.
    static void
    status(org.gradle.api.logging.Logger logger, String pattern, Object... args)
    Always-visible line at lifecycle level, prefixed with [Spring].
    static void
    warn(org.gradle.api.logging.Logger logger, String pattern, Object... args)
    Always-visible warning at warn level, prefixed with [Spring].

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PREFIX

      public static final String PREFIX
      Single source of truth for the prefix added to every Spring Quickstart log line.
      See Also:
    • VERBOSE_PROJECT_PROPERTY

      public static final String VERBOSE_PROJECT_PROPERTY
      Gradle project property that toggles verbose output without editing the build script.
      See Also:
  • Method Details

    • detail

      public static void detail(org.gradle.api.logging.Logger logger, boolean verbose, String pattern, Object... args)
      Detail line: lifecycle when verbose=true, info otherwise. Use for routine configuration values (dependency lists, compiler args, coverage exclusions).
      Parameters:
      logger - the logger
      verbose - whether verbose output is enabled
      pattern - SLF4J-style pattern (without the [Spring] prefix)
      args - pattern arguments
    • header

      public static void header(org.gradle.api.logging.Logger logger, String pattern, Object... args)
      Section header: emits a blank line followed by [Spring] <pattern> at lifecycle level. Use for the first line of each convention (e.g. "Applying Jacoco convention").
      Parameters:
      logger - the logger
      pattern - SLF4J-style pattern (without the [Spring] prefix)
      args - pattern arguments
    • isVerbose

      public static boolean isVerbose(org.gradle.api.Project project, SpringQuickstartExtension extension)
      Resolves the effective verbose flag: the Gradle project property "spring.verbose" wins when set, otherwise the extension default (SpringQuickstartExtension.getVerbose()) is used.
      Parameters:
      project - the project
      extension - the Spring Quickstart extension
      Returns:
      whether verbose logging is enabled
    • logDependencies

      @SafeVarargs public static void logDependencies(boolean verbose, List<PluginDependency>... dependencies)
      Logs a grouped, aligned "dependencies:" block at detail verbosity. Empty groups are skipped.
      Parameters:
      verbose - whether verbose output is enabled
      dependencies - one or more groups of dependencies
    • status

      public static void status(org.gradle.api.logging.Logger logger, String pattern, Object... args)
      Always-visible line at lifecycle level, prefixed with [Spring].
      Parameters:
      logger - the logger
      pattern - SLF4J-style pattern (without the [Spring] prefix)
      args - pattern arguments
    • warn

      public static void warn(org.gradle.api.logging.Logger logger, String pattern, Object... args)
      Always-visible warning at warn level, prefixed with [Spring].
      Parameters:
      logger - the logger
      pattern - SLF4J-style pattern (without the [Spring] prefix)
      args - pattern arguments