private static async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e) { // unbind we're going to re-enter and don't want to loop... Application.Current.UnhandledException -= App_UnhandledException; // say we've handled this one. this allows our FATAL write to complete. e.Handled = true; // go... var log = (ILoggerAsync)pcl::MetroLog.LogManagerFactory.DefaultLogManager.GetLogger <Application>(); await log.FatalAsync("The application crashed: " + e.Message, e.Exception); // if we're aborting, fake a suspend to flush the targets... await LazyFlushManager.FlushAllAsync(new LogWriteContext()); // abort the app here... Application.Current.Exit(); }
public override void OnLogManagerCreated(ILogManager manager) { // initialize the suspend manager... LazyFlushManager.Initialize(manager); }
internal static void Initialize(ILogManager manager) { Owners[manager] = new LazyFlushManager(manager); }