<commit_before>import {StringWrapper} from "./StringWrapper";


class Toggles {
    public queries: boolean;
    public messages: boolean;
    public variables: boolean;
    public hour_glass: boolean;
    public events: boolean;
    public markers: boolean;

    constructor(show: boolean) {
        this.queries = show;
        this.messages = show;
        this.variables = show;
        this.hour_glass = show;
        this.markers = show;
        this.events = show;
    }
}

function printType(value:any) {
    return `<${value.constructor.name}>`;
}

function getCallingMethod(additional_stack: number) {
    const re = /at ([^(]+) \(/g;
    const stack = `${new Error().stack}`;
    const lines = stack.split("\n");
    const stackDepth = 2 + additional_stack;
    const line = lines[stackDepth]
    const aRegexResult = re.exec(line) ?? [];
    const name = aRegexResult[1] || aRegexResult[2];
    return name;
}

export class LoggingInstance {
    logger: (text: string) => void;
    private counter: number = 0;
    private tabs: number = 0;
    private toggles = new Toggles(true);
    public log_stack_traces: boolean = true;
    private log_with_timestamps: boolean = true;
    public timer: () => Date;
    private previous_timestamp: Date | null = null;

    constructor() {
        this.logger = console.log;
        this.timer = () => new Date();
    }<commit_msg>B better log output<commit_after>import {StringWrapper} from "./StringWrapper";


class Toggles {
    public queries: boolean;
    public messages: boolean;
    public variables: boolean;
    public hour_glass: boolean;
    public events: boolean;
    public markers: boolean;

    constructor(show: boolean) {
        this.queries = show;
        this.messages = show;
        this.variables = show;
        this.hour_glass = show;
        this.markers = show;
        this.events = show;
    }
}

function printType(value:any) {
    return `<${value.constructor.name}>`;
}

function getCallingMethod(additional_stack: number) {
    const re = /at ([^(]+) \(/g;
    const stack = `${new Error().stack}`;
    const lines = stack.split("\n");
    const stackDepth = 2 + additional_stack;
    const line = lines[stackDepth]
    const aRegexResult = re.exec(line) ?? [];
    const name = aRegexResult[1] || aRegexResult[2];
    return name;
}

export class LoggingInstance {
    logger: (text: string) => void;
    private counter: number = 0;
    private tabs: number = 0;
    private toggles = new Toggles(true);
    public log_stack_traces: boolean = true;
    private log_with_timestamps: boolean = true;
    public timer: () => Date;
    private previous_timestamp: Date | null = null;

    constructor() {
        this.logger =  (s) => process.stdout.write(s);
        this.timer = () => new Date();
    }
{'fraction_non_alphanumeric': 0.12652329749103944, 'fraction_numerical': 0.0035842293906810036, 'mean_word_length': 2.89804469273743, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '5549785', 'n_tokens_mistral': 851, 'n_tokens_neox': 833, 'n_words': 230}