protected override async void OnStartup(StartupEventArgs e) { WindowsServicesManager servicesManager = new WindowsServicesManager(); servicesManager.Initialize(); FileLoggerHandler.Initialize(servicesManager.FileService); DispatcherHelper.RegisterDispatcher(new WindowsDispatcher(this.Dispatcher)); DialogHelper.Initialize(new WPFDialogShower()); Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; await ChannelSession.Initialize(servicesManager); WindowsIdentity id = WindowsIdentity.GetCurrent(); ChannelSession.IsElevated = id.Owner != id.User; Logger.ForceLog(LogLevel.Information, "Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion()); if (ChannelSession.IsDebug() || ChannelSession.AppSettings.DiagnosticLogging) { Logger.SetLogLevel(LogLevel.Debug); } else { Logger.SetLogLevel(LogLevel.Error); } this.SwitchTheme(ChannelSession.AppSettings.ColorScheme, ChannelSession.AppSettings.BackgroundColor, ChannelSession.AppSettings.FullThemeName); base.OnStartup(e); }
public static FileLoggerHandler InitializeUnitTestLogger(string appName = "UnitTest") { var h = new FileLoggerHandler(string.Empty, GetAppDataFolder(appName)); Logger.LoggerHandlerManager .AddHandler(h) .AddHandler(new DebugConsoleLoggerHandler()); FileLoggerHandler = h; return h; }
void SetupLogging() { var fileHandler = new FileLoggerHandler("IsThisGeekAliveMonitor.log.txt", ProjectUtils.GetSettingsDirectory()); SimpleLogger.Logger.LoggerHandlerManager.AddHandler(fileHandler); }