<commit_before>﻿using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace phoenix
{
    class TextboxWriterTraceListener : TraceListener
    {
        private TextBoxBase logbox;

        public TextboxWriterTraceListener(TextBoxBase box, string name)
        {
            Name = name;
            logbox = box;
        }

        public override void Write(string message)
        {
            logbox.AppendText(message + Environment.NewLine);
        }

        public override void WriteLine(string message)
        {
            Write(message);
        }
    }<commit_msg>don't log if output box is disposed or null<commit_after>﻿using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace phoenix
{
    class TextboxWriterTraceListener : TraceListener
    {
        private TextBoxBase logbox;

        public TextboxWriterTraceListener(TextBoxBase box, string name)
        {
            Name = name;
            logbox = box;
        }

        public override void Write(string message)
        {
            if (logbox == null || logbox.IsDisposed) return;
            logbox.AppendText(message + Environment.NewLine);
        }

        public override void WriteLine(string message)
        {
            Write(message);
        }
    }
{'fraction_non_alphanumeric': 0.07059736229635376, 'fraction_numerical': 0.0, 'mean_word_length': 2.049645390070922, 'pattern_counts': {'":': 0, '<': 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': '7573158', 'n_tokens_mistral': 332, 'n_tokens_neox': 326, 'n_words': 85}