<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hadouken.Hosting;
using Hadouken.Http;
using Hadouken.Data;
using Hadouken.Plugins;
using Hadouken.BitTorrent;

namespace Hadouken.Impl.Hosting
{
    public class DefaultHost : IHost
    {
        private IDataRepository _data;
        private IBitTorrentEngine _torrentEngine;
        private IMigrationRunner _migratorRunner;
        private IPluginEngine _pluginEngine;
        private IHttpServer _httpServer;

        public DefaultHost(IDataRepository data, IBitTorrentEngine torrentEngine, IMigrationRunner runner, IPluginEngine pluginEngine, IHttpServer httpServer)
        {
            _data = data;
            _torrentEngine = torrentEngine;
            _migratorRunner = runner;
            _pluginEngine = pluginEngine;
            _httpServer = httpServer;

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
        }
<commit_msg>Added logging for unhandled exceptions.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hadouken.Hosting;
using Hadouken.Http;
using Hadouken.Data;
using Hadouken.Plugins;
using Hadouken.BitTorrent;
using NLog;

namespace Hadouken.Impl.Hosting
{
    public class DefaultHost : IHost
    {
        private static Logger _logger = LogManager.GetCurrentClassLogger();

        private IDataRepository _data;
        private IBitTorrentEngine _torrentEngine;
        private IMigrationRunner _migratorRunner;
        private IPluginEngine _pluginEngine;
        private IHttpServer _httpServer;

        public DefaultHost(IDataRepository data, IBitTorrentEngine torrentEngine, IMigrationRunner runner, IPluginEngine pluginEngine, IHttpServer httpServer)
        {
            _data = data;
            _torrentEngine = torrentEngine;
            _migratorRunner = runner;
            _pluginEngine = pluginEngine;
            _httpServer = httpServer;

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
        }

        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            _logger.FatalException("Unhandled exception.", e.ExceptionObject as Exception);
        }

{'fraction_non_alphanumeric': 0.05735056542810985, 'fraction_numerical': 0.0, 'mean_word_length': 3.407473309608541, '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': '7050161', 'n_tokens_mistral': 640, 'n_tokens_neox': 641, 'n_words': 150}