GetCurrentClassLogger() private méthode

private GetCurrentClassLogger ( ) : Logger
Résultat Logger
        protected override void Configure()
        {
            // Sleep for a while if ran from autorun to allow full system boot
            if (Environment.GetCommandLineArgs().Contains("--autorun"))
            {
                var logger = LogManager.GetCurrentClassLogger();
                logger.Info("Artemis was run using the autorun shortcut, sleeping for 15 sec.");
                Thread.Sleep(15000);
            }

            _kernel = new StandardKernel(new BaseModules(), new ManagerModules());

            _kernel.Bind <IWindowManager>().To <WindowManager>().InSingletonScope();
            _kernel.Bind <IEventAggregator>().To <EventAggregator>().InSingletonScope();

            // Configure JSON.NET
            var settings = new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.Auto,
                ContractResolver = _kernel.Get <NinjectContractResolver>()
            };

            JsonConvert.DefaultSettings = () => settings;

            //TODO DarthAffe 17.12.2016: Is this the right location for this?
            //TODO Move to Mainmanager and make disposable
            ActiveWindowHelper.SetActiveWindowDetectionType(SettingsProvider.Load <GeneralSettings>().ActiveWindowDetection);
        }
        protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            if (loggingReady)
            {
                Logger logger = LogManager.GetCurrentClassLogger();
                logger.Error(e.Exception, "Received unhandled exception, exiting");
            }

            base.OnUnhandledException(sender, e);
        }
Exemple #3
0
        /// <summary>
        /// By default, we are configured to use MEF
        /// </summary>
        protected override void Configure()
        {
            if (!Directory.Exists(_dataFolder))
            {
                Directory.CreateDirectory(_dataFolder);
            }

            _settingsProvider = new SettingsProvider(_dataFolder);

            ConfigureLogging();

            AppDomain.CurrentDomain.FirstChanceException += (sender, args) =>
                                                            LogManager.GetCurrentClassLogger().ErrorException("FirstChanceException", args.Exception);
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
                                                          LogManager.GetCurrentClassLogger().ErrorException("UnhandledException", args.ExceptionObject as Exception);
            Application.DispatcherUnhandledException += (sender, args) =>
                                                        LogManager.GetCurrentClassLogger().ErrorException("DispatcherUnhandledException", args.Exception);
            TaskScheduler.UnobservedTaskException += (sender, args) =>
                                                     LogManager.GetCurrentClassLogger().ErrorException("UnobservedTaskException", args.Exception);

            var catalog = new AggregateCatalog(
                AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType <ComposablePartCatalog>()
                );

            _container = new CompositionContainer(catalog);

            var batch = new CompositionBatch();

            batch.AddExportedValue <IWindowManager>(new WindowManager());
            batch.AddExportedValue <IEventAggregator>(new EventAggregator());
            batch.AddExportedValue(_settingsProvider.Settings);
            batch.AddExportedValue(_container);
            batch.AddExportedValue(catalog);

            _container.Compose(batch);
        }
 public ExceptionResultAttribute(ExceptionResultMode mode)
 {
     _mode   = mode;
     _logger = LogManager.GetCurrentClassLogger();
 }