<commit_before>package gd.twohundred.jvb;

import java.io.PrintStream;
import java.util.EnumMap;
import java.util.Formatter;
import java.util.Map;

import static gd.twohundred.jvb.Logger.Level.Error;

public class StdLogger implements Logger {
    private final Map<Component, Level> levels = new EnumMap<>(Component.class);

    public StdLogger() {
        for (Component c : Component.values()) {
            levels.put(c, Level.Warning);
        }
    }

    @Override
    public void log(Component component, Level level, String format, Object... args) {
        PrintStream stream = level.ordinal() <= Error.ordinal() ? System.err : System.out;
        StringBuilder sb = new StringBuilder();
        Formatter formatter = new Formatter(sb);
        formatter.format("[%7s][%6s] ", level, component);
        formatter.format(format, args);
        sb.append(System.lineSeparator());
        stream.print(sb);
    }

    @Override
    public boolean isLevelEnabled(Component component, Level level) {
        return levels.get(component).ordinal() >= level.ordinal();
    }
}<commit_msg>Fix stdout logger<commit_after>package gd.twohundred.jvb;

import java.io.PrintStream;
import java.util.EnumMap;
import java.util.Formatter;
import java.util.Map;

import static gd.twohundred.jvb.Logger.Level.Error;

public class StdLogger implements Logger {
    private final Map<Component, Level> levels = new EnumMap<>(Component.class);

    public StdLogger() {
        for (Component c : Component.values()) {
            levels.put(c, Level.Warning);
        }
    }

    @Override
    public void log(Component component, Level level, String format, Object... args) {
        if (isLevelEnabled(component, level)) {
            PrintStream stream = level.ordinal() <= Error.ordinal() ? System.err : System.out;
            StringBuilder sb = new StringBuilder();
            Formatter formatter = new Formatter(sb);
            formatter.format("[%7s][%6s] ", level, component);
            formatter.format(format, args);
            sb.append(System.lineSeparator());
            stream.print(sb);
        }
    }

    @Override
    public boolean isLevelEnabled(Component component, Level level) {
        return levels.get(component).ordinal() >= level.ordinal();
    }
}
{'fraction_non_alphanumeric': 0.12170474516695957, 'fraction_numerical': 0.0017574692442882249, 'mean_word_length': 2.953125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '4922031', 'n_tokens_mistral': 642, 'n_tokens_neox': 632, 'n_words': 155}