<commit_before>package io.bootique.example.kafka.consumer;

import com.google.inject.Binder;
import com.google.inject.Module;
import io.bootique.BQCoreModule;
import io.bootique.Bootique;

/**
 * Main app class.
 */
public class App implements Module {

    // TODO: add support for --verbose option once https://github.com/bootique/bootique/issues/101 becomes available.

    public static void main(String[] args) {
        Bootique.app("--config=classpath:defaults.yml").args(args).autoLoadModules().module(App.class).run();
    }

    @Override
    public void configure(Binder binder) {
        BQCoreModule.setDefaultCommand(binder, KafkaConsumerCommand.class);
    }


}<commit_msg>--v flag ... temp impl<commit_after>package io.bootique.example.kafka.consumer;

import com.google.inject.Binder;
import com.google.inject.BindingAnnotation;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import io.bootique.BQCoreModule;
import io.bootique.Bootique;
import io.bootique.application.OptionMetadata;
import io.bootique.cli.Cli;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.logging.Level;

/**
 * Main app class.
 */
public class App implements Module {

    private static final String VERBOSE_OPT = "verbose";

    public static void main(String[] args) {
        Bootique.app("--config=classpath:defaults.yml").args(args).autoLoadModules().module(App.class).run();
    }

    private static OptionMetadata verboseOption() {
        return OptionMetadata.builder(VERBOSE_OPT)
                .description("If enabled, Kafka client will prints extra debugging information to STDOUT.").build();
    }

    @Override
    public void configure(Binder binder) {
        BQCoreModule.setDefaultCommand(binder, KafkaConsumerCommand.class);
        BQCoreModule.contributeOptions(binder).addBinding().toInstance(verboseOption());

        // TODO: perhaps we'll invent less verbose API for conditional setting of log levels per
        // https://github.com/bootique/bootique/issues/101
        BQCoreModule.contributeLogLevels(binder).addBinding("org.apache.kafka").to(Key.get(Level.class, KafkaLogLevel.class));
        BQCoreModule.contributeLogLevels(binder).addBinding("io.bootique").to(Key.get(Level.class, BootiqueLogLevel.class));
    }


    @KafkaLogLevel
    @Provides
    @Singleton
    Level provideKafkaLogLevel(Cli cli) {
        return cli.hasOption(VERBOSE_OPT) ? Level.INFO : Level.WARNING;
    }

    @BootiqueLogLevel
    @Provides
    @Singleton
    Level provideBootiqueLogLevel(Cli cli) {
        return cli.hasOption(VERBOSE_OPT) ? Level.INFO : Level.WARNING;
    }

    @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
    @Retention(RetentionPolicy.RUNTIME)
    @BindingAnnotation
    @interface KafkaLogLevel {
    }

    @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
    @Retention(RetentionPolicy.RUNTIME)
    @BindingAnnotation
    @interface BootiqueLogLevel {
    }
}
{'fraction_non_alphanumeric': 0.11374407582938388, 'fraction_numerical': 0.0018957345971563982, 'mean_word_length': 3.985826771653543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4737523', 'n_tokens_mistral': 963, 'n_tokens_neox': 931, 'n_words': 174}