<commit_before>var sys = require("sys");
var ansi = require("buster-test/lib/buster-test/ansi-out");

module.exports = {
    create: function (opt) {
        var reporter = Object.create(this);
        reporter.ansi = ansi.create(opt);
        reporter.list = reporter.ansi.labeledList(opt && opt.io);

        return reporter;
    },

    listen: function (runner) {
        runner.bind(this, {
            "progress:test:success": "testSuccess",
            "progress:test:error": "testError",
            "progress:test:failure": "testFailure",
            "progress:test:timeout": "testTimeout"
        });

        return this;
    },

    testSuccess: function (test) {
        this.print(test.client, this.ansi.green("."));
    },

    testError: function (test) {
        this.print(test.client, this.ansi.yellow("E"));
    },

    testFailure: function (test) {
        this.print(test.client, this.ansi.red("F"));
    },

    testTimeout: function (test) {
        this.print(test.client, this.ansi.red("T"));
    },

    displayProgress: function (client, output) {
        if (!this.list) {
            return this.bufferOutput(client, output);
        }

        this.print(client, output);
    },

    print: function (client, output) {
        this.list.print(this.clients[client.id], output);
    },

    addClient: function (clientId, agent) {
        this.clients = this.clients || {};
        var agentStr = agent.toString();
        this.clients[clientId] = agentStr;
        this.list.add(agentStr);
    }
};<commit_msg>Use buster-terminal for string formatting<commit_after>var sys = require("sys");
var terminal = require("buster-terminal");

module.exports = {
    create: function (opt) {
        var reporter = Object.create(this);
        reporter.terminal = terminal.create(opt);
        reporter.list = terminal.labeledList.create(opt && opt.io);

        return reporter;
    },

    listen: function (runner) {
        runner.bind(this, {
            "progress:test:success": "testSuccess",
            "progress:test:error": "testError",
            "progress:test:failure": "testFailure",
            "progress:test:timeout": "testTimeout"
        });

        return this;
    },

    testSuccess: function (test) {
        this.print(test.client, this.terminal.green("."));
    },

    testError: function (test) {
        this.print(test.client, this.terminal.yellow("E"));
    },

    testFailure: function (test) {
        this.print(test.client, this.terminal.red("F"));
    },

    testTimeout: function (test) {
        this.print(test.client, this.terminal.red("T"));
    },

    displayProgress: function (client, output) {
        if (!this.list) {
            return this.bufferOutput(client, output);
        }

        this.print(client, output);
    },

    print: function (client, output) {
        this.list.print(this.clients[client.id], output);
    },

    addClient: function (clientId, agent) {
        this.clients = this.clients || {};
        var agentStr = agent.toString();
        this.clients[clientId] = agentStr;
        this.list.add(agentStr);
    }
};
{'fraction_non_alphanumeric': 0.1532542481564604, 'fraction_numerical': 0.0, 'mean_word_length': 2.394994559303591, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, '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': '5007107', 'n_tokens_mistral': 952, 'n_tokens_neox': 921, 'n_words': 170}