<commit_before>// Copyright 2016 <NAME>. All rights reserved.

"use strict";

import * as contract from '../contract';

export interface ILogger {
    infof(msg: string, ...args: any[]): void;
    errorf(msg: string, ...args: any[]): void;
    fatalf(msg: string, ...args: any[]): void;
}

let consoleLogger: ILogger = {
    infof: (msg: string, ...args: any[]) => {
        console.log(msg, ...args);
    },
    errorf: (msg: string, ...args: any[]) => {
        console.error(msg, ...args);
    },
    fatalf: (msg: string, ...args: any[]) => {
        contract.failf(msg, ...args);
    },
};
let ignoreLogger: ILogger = {
    infof: (msg: string, ...args: any[]) => {},
    errorf: (msg: string, ...args: any[]) => {},
    fatalf: (msg: string, ...args: any[]) => {},
};

export function Get(t?: number): ILogger {
    if (!!t || t >= v) {
        return consoleLogger;
    }
    return ignoreLogger;
}

let v: number = 0;

export function Set(t: number): void {
    v = t;
}

export function V(t: number): boolean {
    return (v >= t);
}

<commit_msg>Rename functions to be less obscure (and cased properly)<commit_after>// Copyright 2016 <NAME>. All rights reserved.

"use strict";

import * as contract from '../contract';

export interface ILogger {
    infof(msg: string, ...args: any[]): void;
    errorf(msg: string, ...args: any[]): void;
    fatalf(msg: string, ...args: any[]): void;
}

let consoleLogger: ILogger = {
    infof: (msg: string, ...args: any[]) => {
        console.log(msg, ...args);
    },
    errorf: (msg: string, ...args: any[]) => {
        console.error(msg, ...args);
    },
    fatalf: (msg: string, ...args: any[]) => {
        contract.failf(msg, ...args);
    },
};
let ignoreLogger: ILogger = {
    infof: (msg: string, ...args: any[]) => {},
    errorf: (msg: string, ...args: any[]) => {},
    fatalf: (msg: string, ...args: any[]) => {},
};

let loglevel: number = 0;

export function configure(threshold: number): void {
    loglevel = threshold;
}

export function out(target?: number): ILogger {
    if (target === undefined || v(target)) {
        return consoleLogger;
    }
    return ignoreLogger;
}

export function v(target: number): boolean {
    return (target <= loglevel);
}

{'fraction_non_alphanumeric': 0.2056451612903226, 'fraction_numerical': 0.004480286738351254, 'mean_word_length': 2.697019867549669, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 19, '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': '4071627', 'n_tokens_mistral': 741, 'n_tokens_neox': 736, 'n_words': 220}