diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs index 1bcbd46c3e..56e1db31f6 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs @@ -32,12 +32,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Diagnostics; - -#if ENABLE_RAYGUN -using System.Threading; -using Mindscape.Raygun4Net; -#endif - +using Mono.Addins; +using MonoDevelop.Core.LogReporting; using MonoDevelop.Core.Logging; using Mono.Unix.Native; @@ -49,9 +45,6 @@ namespace MonoDevelop.Core const string ReportCrashesKey = "MonoDevelop.LogAgent.ReportCrashes"; const string ReportUsageKey = "MonoDevelop.LogAgent.ReportUsage"; -#if ENABLE_RAYGUN - static RaygunClient raygunClient; -#endif static List<ILogger> loggers = new List<ILogger> (); static RemoteLogger remoteLogger; static DateTime timestamp; @@ -66,6 +59,8 @@ namespace MonoDevelop.Core // Thirdparameter shows if the exception is fatal or not public static Func<bool?, Exception, bool, bool?> UnhandledErrorOccured; + static List<CrashReporter> customCrashReporters = new List<CrashReporter> (); + static LoggingService () { var consoleLogger = new ConsoleLogger (); @@ -102,13 +97,6 @@ namespace MonoDevelop.Core timestamp = DateTime.Now; -#if ENABLE_RAYGUN - string raygunKey = BrandingService.GetString ("RaygunApiKey"); - if (raygunKey != null) { - raygunClient = new RaygunClient (raygunKey); - } -#endif - //remove the default trace listener on .NET, it throws up horrible dialog boxes for asserts Debug.Listeners.Clear (); @@ -186,6 +174,18 @@ namespace MonoDevelop.Core RestoreOutputRedirection (); } + public static void RegisterCrashReporter (CrashReporter reporter) + { + lock (customCrashReporters) + customCrashReporters.Add (reporter); + } + + public static void UnregisterCrashReporter (CrashReporter reporter) + { + lock (customCrashReporters) + customCrashReporters.Remove (reporter); + } + internal static void ReportUnhandledException (Exception ex, bool willShutDown) { ReportUnhandledException (ex, willShutDown, false, null); @@ -215,22 +215,10 @@ namespace MonoDevelop.Core if (ReportCrashes.HasValue && !ReportCrashes.Value) return; - var customData = new Hashtable (); - foreach (var cd in SystemInformation.GetDescription ()) - customData[cd.Title ?? ""] = cd.Description; - -#if ENABLE_RAYGUN - if (raygunClient != null) { - ThreadPool.QueueUserWorkItem (delegate { - try { - raygunClient.Send (ex, tags, customData, Runtime.Version.ToString ()); - } catch { - // If we get here then things have gone really wrong - we can't log anything or - // attempt to report anything. Drop any exception that ends up here. - } - }); + lock (customCrashReporters) { + foreach (var cr in customCrashReporters.Concat (AddinManager.GetExtensionObjects<CrashReporter> (true))) + cr.ReportCrash (ex, willShutDown, tags); } -#endif //ensure we don't lose the setting if (ReportCrashes != oldReportCrashes) { @@ -549,5 +537,4 @@ namespace MonoDevelop.Core #endregion } - } |