Repository: open-telemetry/opentelemetry-java
File: sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/LoggerConfig.java (Java)

Code before:
  /**
   * Returns the default {@link LoggerConfig}, which is used when no configurator is set or when the
   * logger configurator returns {@code null} for a {@link InstrumentationScopeInfo}.
   */
  public static LoggerConfig defaultConfig() {
    return DEFAULT_CONFIG;
  }

  /**
   * Create a {@link ScopeConfiguratorBuilder} for configuring {@link
   * SdkLoggerProviderUtil#setLoggerConfigurator(SdkLoggerProviderBuilder, ScopeConfigurator)}.
   */
  public static ScopeConfiguratorBuilder<LoggerConfig> configuratorBuilder() {
    return ScopeConfigurator.builder();
  }

  LoggerConfig() {}

  /**
   * Builder for {@link LoggerConfig}.
   *
   * <p>This class is internal and experimental. Its APIs are unstable and can change at any time.
   * Its APIs (or a version of them) may be promoted to the public stable API in the future, but no
   * guarantees are made.
   */
  public static final class Builder {
    private boolean enabled = true;
    private int minimumSeverity = 0;
    private boolean traceBased = false;

    private Builder() {}

    /**
     * Sets whether the logger is enabled.
     *
     * @param enabled whether the logger is enabled
     * @return this builder
     */
    public Builder setEnabled(boolean enabled) {
      this.enabled = enabled;
      return this;
    }

    /**
     * Sets the minimum severity level for log records to be processed.
     *
     * <p>Log records with a severity number less than this value will be dropped. Log records
     * without a specified severity are not affected by this setting.
     *
     * @param minimumSeverity minimum severity level for log records to be processed
     * @return this builder

Review comment (suggestion):
For better or worse, the pattern in this repo is to have top level builder classes rather that static inner classes. I think we should follow this here to slightly reduce the churn when this eventually stabilizes. I say slightly because the package will still change. 

Code after:
  /** Returns a new {@link LoggerConfigBuilder} for creating a {@link LoggerConfig}. */
  public static LoggerConfigBuilder builder() {
    return new LoggerConfigBuilder();
  }

  /**
   * Returns the default {@link LoggerConfig}, which is used when no configurator is set or when the
   * logger configurator returns {@code null} for a {@link InstrumentationScopeInfo}.
   */
  public static LoggerConfig defaultConfig() {
    return DEFAULT_CONFIG;
  }

  /**
   * Create a {@link ScopeConfiguratorBuilder} for configuring {@link
   * SdkLoggerProviderUtil#setLoggerConfigurator(SdkLoggerProviderBuilder, ScopeConfigurator)}.
   */
  public static ScopeConfiguratorBuilder<LoggerConfig> configuratorBuilder() {
    return ScopeConfigurator.builder();
  }

  LoggerConfig() {}

  static LoggerConfig create(boolean enabled, Severity minimumSeverity, boolean traceBased) {
    return new AutoValue_LoggerConfig(enabled, minimumSeverity, traceBased);
  }

  /** Returns {@code true} if this logger is enabled. Defaults to {@code true}. */
  public abstract boolean isEnabled();

  /**
   * Returns the minimum severity level for log records to be processed.
   *
   * <p>Log records with a severity number less than this value will be dropped. Log records without
   * a specified severity are not affected by this setting.
   *
   * <p>Defaults to {@link Severity#UNDEFINED_SEVERITY_NUMBER}.
   */
  public abstract Severity getMinimumSeverity();

  /**
   * Returns {@code true} if this logger should only process log records from traces when the trace
   * is sampled.
   *
   * <p>When enabled, log records from unsampled traces will be dropped. Log records that are not
   * associated with a trace context are unaffected.
   *
   * <p>Defaults to {@code false}.
   */
  public abstract boolean isTraceBased();
}