<commit_before>/*
 * Created on 04.des.2005
 *
 * Copyright (c) 2005, <NAME> <<EMAIL>>
 * 
 * Licensed under the GNU Lesser General Public License, v2.1
 */
package org.spoofax.jsglr;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.BufferedOutputStream;
import java.io.OutputStream;

public class Tools {
    
    private static OutputStream fos;
    private static String outfile = null;

    public static void setOutput(String d) {
        outfile = d;
        initOutput();
    }

    private static void initOutput() {
        if(fos == null) {
            try {
                if(outfile == null)
                    outfile = ".jsglr-log";
                fos = new BufferedOutputStream(new FileOutputStream(outfile));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
    
    public static void debug(Object ...s) {
        // FIXME Copy debug() from org.spoofax.interpreter
        for(Object o : s) {
            System.err.print(o);
        }
        System.err.println("");
    }
<commit_msg>Ensure that the logging system is initialized.<commit_after>/*
 * Created on 04.des.2005
 *
 * Copyright (c) 2005, <NAME> <<EMAIL>>
 * 
 * Licensed under the GNU Lesser General Public License, v2.1
 */
package org.spoofax.jsglr;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.BufferedOutputStream;
import java.io.OutputStream;

public class Tools {
    
    private static OutputStream fos;
    private static String outfile = null;

    static {
    	initOutput();
    }
    
    public static void setOutput(String d) {
        outfile = d;
        initOutput();
    }

    private static void initOutput() {
        if(fos == null) {
            try {
                if(outfile == null)
                    outfile = ".jsglr-log";
                fos = new BufferedOutputStream(new FileOutputStream(outfile));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
    
    public static void debug(Object ...s) {
        // FIXME Copy debug() from org.spoofax.interpreter
        for(Object o : s) {
            System.err.print(o);
        }
        System.err.println("");
    }

{'fraction_non_alphanumeric': 0.10629251700680271, 'fraction_numerical': 0.01020408163265306, 'mean_word_length': 2.001275510204082, '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': '7053203', 'n_tokens_mistral': 691, 'n_tokens_neox': 665, 'n_words': 176}