Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ShutdownMode = ShutdownMode.OnLastWindowClose;

            DispatcherUnhandledException += (sender, args) =>
            {
                LogException(LogLevel.Critical, args.Exception);
                Logger.FlushAllAsync().Wait();
#if DEBUG
                args.Handled = true;
#else
                Current.Shutdown();
#endif
            };

#if DEBUG
            Logger.Level = LogLevel.Trace;
            Logger.AddBannedScope("GENERATOR");
            var logger = new ObservableLogger(1000, RunOnUiThreadAsync);
            Logger.RegisterReceiver(logger);
            _logWindow = new LogWindow(logger);
            _logWindow.Show();
#else
            Logger.Level = LogLevel.None;
#endif

            LogMessage(LogLevel.Info, "Application ready");
        }
Example #2
0
 public static void Mute() => Logger.AddBannedScope(LogScope);