<commit_before>﻿using log4net;
using OHM.Logger;
using System;
using System.Windows.Controls;

namespace WpfApplication1.Logger
{
    public class WpfLogger : DefaultLogger, ILogger
    {
        private TextBox output;
        public WpfLogger(ILog log, TextBox output)
            : base(log)
        {
            this.output = output;
        }

        public override void Debug(object message)
        {
            base.Debug(message);
            wpfLog("DEBUG: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Debug(object message, Exception exception)
        {
            base.Debug(message, exception);
            wpfLog("DEBUG: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Error(object message)
        {
            base.Error(message);
            wpfLog("ERROR: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Error(object message, Exception exception)
        {
            base.Error(message, exception);
            wpfLog("ERROR: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Fatal(object message)
        {
            base.Fatal(message);
            wpfLog("FATAL: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Fatal(object message, Exception exception)
        {
            base.Fatal(message, exception);
            wpfLog("FATAL: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Info(object message)
        {
            base.Info(message);
            wpfLog("INFO: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Info(object message, Exception exception)
        {
            base.Info(message, exception);
            wpfLog("INFO: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Warn(object message)
        {
            base.Warn(message);
            wpfLog("WARN: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Warn(object message, Exception exception)
        {
            base.Warn(message, exception);
            wpfLog("WARN: " + this.Logger.Name + ": " + message.ToString());
        }

        public void wpfLog(string message)
        {
            output.Dispatcher.BeginInvoke(new Action(delegate
            {
                output.AppendText(message + "\n");
            }));
        }
    }
}<commit_msg>Gestion des erreurs dans le log wpf<commit_after>﻿using log4net;
using OHM.Logger;
using System;
using System.Windows.Controls;

namespace WpfApplication1.Logger
{
    public class WpfLogger : DefaultLogger, ILogger
    {
        private TextBox output;
        public WpfLogger(ILog log, TextBox output)
            : base(log)
        {
            this.output = output;
        }

        public override void Debug(object message)
        {
            base.Debug(message);
            wpfLog("DEBUG: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Debug(object message, Exception exception)
        {
            base.Debug(message, exception);
            wpfLog("DEBUG: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Error(object message)
        {
            base.Error(message);
            wpfLog("ERROR: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Error(object message, Exception exception)
        {
            base.Error(message, exception);
            wpfLog("ERROR: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Fatal(object message)
        {
            base.Fatal(message);
            wpfLog("FATAL: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Fatal(object message, Exception exception)
        {
            base.Fatal(message, exception);
            wpfLog("FATAL: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Info(object message)
        {
            base.Info(message);
            wpfLog("INFO: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Info(object message, Exception exception)
        {
            base.Info(message, exception);
            wpfLog("INFO: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Warn(object message)
        {
            base.Warn(message);
            wpfLog("WARN: " + this.Logger.Name + ": " + message.ToString());
        }

        public override void Warn(object message, Exception exception)
        {
            base.Warn(message, exception);
            wpfLog("WARN: " + this.Logger.Name + ": " + message.ToString());
        }

        public void wpfLog(string message)
        {
            output.Dispatcher.BeginInvoke(new Action(delegate
            {
                try
                {
                    output.AppendText(message + "\n");
                }
                catch (Exception)
                {
                    //throw;
                }
                
            }));
        }
    }
}
{'fraction_non_alphanumeric': 0.11892197512250283, 'fraction_numerical': 0.0007538635506973238, 'mean_word_length': 1.669517102615694, 'pattern_counts': {'":': 20, '<': 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': '6869156', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1363, 'n_words': 288}