Exemplo n.º 1
0
        public static void SendError(RaygunClient client, Exception e, StoredMessage storedMessage)
        {
            var extraData = StoredMessageToDictionary(storedMessage);
            AddServiceControlVersion(extraData);

            client.SendInBackground(e, null, extraData);
        }
        /// <summary>
        /// Adds a sink that writes log events (defaults to error and up) to the Raygun.io webservice. Properties are being send as data and the level is used as a tag.
        /// Your message is part of the custom data.
        /// </summary>
        /// <param name="loggerConfiguration">The logger configuration.</param>
        /// <param name="raygunClient">An existing configured raygun client</param>
        /// <param name="tags">Specifies the tags to include with every log message. The log level will always be included as a tag.</param>
        /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink. By default set to Error as Raygun is mostly used for error reporting.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">A required parameter is null.</exception>
        public static LoggerConfiguration Raygun(this LoggerSinkConfiguration loggerConfiguration, RaygunClient raygunClient, IEnumerable<string> tags, LogEventLevel restrictedToMinimumLevel = LogEventLevel.Error, IFormatProvider formatProvider = null)
        {
            if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
            if (raygunClient == null) throw new ArgumentNullException(nameof(raygunClient));

            return loggerConfiguration.Sink(new RaygunSink(formatProvider, raygunClient, tags), restrictedToMinimumLevel);
        }
Exemplo n.º 3
0
        public static void SendError(RaygunClient client, Exception e)
        {
            var extraData = new Dictionary<string, object>();
            AddServiceControlVersion(extraData);

            client.SendInBackground(e, null, extraData);
        }
Exemplo n.º 4
0
        public PulseEventBatch(RaygunClient raygunClient)
        {
            _raygunClient = raygunClient;
              _lastUpdate = DateTime.UtcNow;

              Thread t = new Thread (CheckTime);
              t.Start ();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructs a sink that saves errors to the Raygun.io service. Properties are being send as userdata and the level is included as tag. The message is included inside the userdata.
        /// </summary>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="raygunClient">An existing raygun client to use</param>
        /// /// <param name="tags">Specifies the tags to include with every log message. The log level will always be included as a tag.</param>
        public RaygunSink(IFormatProvider formatProvider, RaygunClient raygunClient, IEnumerable<string> tags = null)
        {
            if (raygunClient == null) throw new ArgumentNullException(nameof(raygunClient));

            _tags = tags ?? new string[0];
            _formatProvider = formatProvider;
            _client = raygunClient;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
 /// </summary>
 /// <returns>The RaygunClient to chain other methods.</returns>
 public RaygunClient AttachCrashReporting()
 {
     RaygunClient.DetachCrashReporting();
     AppDomain.CurrentDomain.UnhandledException  += CurrentDomain_UnhandledException;
     TaskScheduler.UnobservedTaskException       += TaskScheduler_UnobservedTaskException;
     AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
     return(this);
 }
 public void Execute(Action<RaygunClient> callback)
 {
     if (_enabled)
     {
         var client = new RaygunClient(_apiKey);
         callback(client);
     }
 }
 static ExceptionHandler()
 {
     var assemblyInfo = typeof(App).Assembly.GetAttribute<AssemblyInformationalVersionAttribute>();
     client = new RaygunClient("uX5c/PiCVqF31xlEm3jShA==")
     {
         ApplicationVersion = assemblyInfo != null ? assemblyInfo.InformationalVersion : "Unknown Version"
     };
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes the static RaygunClient with the given Raygun api key.
 /// </summary>
 /// <param name="apiKey">Your Raygun api key for this application.</param>
 /// <returns>The RaygunClient to chain other methods.</returns>
 public static RaygunClient Initialize(string apiKey)
 {
     if (_client == null)
     {
         _client = new RaygunClient(apiKey);
     }
     return(_client);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
 /// </summary>
 /// <param name="apiKey">Your app api key.</param>
 public static void Attach(string apiKey)
 {
     Detach();
     _client = new RaygunClient(apiKey);
     AppDomain.CurrentDomain.UnhandledException  += CurrentDomain_UnhandledException;
     TaskScheduler.UnobservedTaskException       += TaskScheduler_UnobservedTaskException;
     AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
 }
Exemplo n.º 11
0
        public PulseEventBatch(RaygunClient raygunClient)
        {
            _raygunClient = raygunClient;
            _lastUpdate   = DateTime.UtcNow;

            Thread t = new Thread(CheckTime);

            t.Start();
        }
Exemplo n.º 12
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions.
 /// </summary>
 /// <param name="apiKey">Your app api key.</param>
 public static void Attach(string apiKey)
 {
     Detach();
     _client = new RaygunClient(apiKey);
     if (Application.Current != null)
     {
         Application.Current.UnhandledException += Current_UnhandledException;
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <returns>The RaygunClient to chain other methods.</returns>
        public RaygunClient AttachCrashReporting()
        {
            RaygunLogger.Debug("Enabling Crash Reporting");

            RaygunClient.DetachCrashReporting();

            SetUnhandledExceptionHandlers();

            return(this);
        }
Exemplo n.º 14
0
        private void SendError(object sender, EventArgs e)
        {
            var application = (HttpApplication)sender;

              var exception = application.Server.GetLastError();

              var raygunClient = new RaygunClient();

              raygunClient.Send(exception);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
 /// </summary>
 /// <param name="apiKey">Your app api key.</param>
 /// <param name="user">An identity string for tracking affected users.</param>
 public static void Attach(string apiKey, string user)
 {
     Detach();
     _client = new RaygunClient(apiKey)
     {
         User = user
     };
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;
 }
Exemplo n.º 16
0
 public static RaygunClient GetClient()
 {
     var assemblyInfo = typeof(App).Assembly.GetAttribute<AssemblyInformationalVersionAttribute>();
     var client = new RaygunClient("uX5c/PiCVqF31xlEm3jShA==")
     {
         ApplicationVersion = assemblyInfo != null ? assemblyInfo.InformationalVersion : "Unknown Version"
     };
     client.AddWrapperExceptions(typeof(AggregateException));
     return client;
 }
Exemplo n.º 17
0
        private RaygunClient CreateRaygunClient()
        {
            var client = new RaygunClient(ApiKey);

            client.IgnoreFormFieldNames(SplitValues(IgnoreFormFieldNames));
            client.IgnoreCookieNames(SplitValues(IgnoreCookieNames));
            client.IgnoreHeaderNames(SplitValues(IgnoreHeaderNames));
            client.IgnoreServerVariableNames(SplitValues(IgnoreServerVariableNames));

            return client;
        }
Exemplo n.º 18
0
        private RaygunClient GenerateDefaultRaygunClient(HttpApplication application)
        {
            var instance = new RaygunClient();

            if (HttpContext.Current != null && HttpContext.Current.Session != null)
            {
                instance.ContextId = HttpContext.Current.Session.SessionID;
            }

            return(instance);
        }
Exemplo n.º 19
0
 internal static void Detach()
 {
     if (_pulse != null && _mainActivity != null && _mainActivity.Application != null)
     {
         _mainActivity.Application.UnregisterActivityLifecycleCallbacks(_pulse);
         _mainActivity    = null;
         _currentActivity = null;
         _pulse           = null;
         _raygunClient    = null;
     }
 }
Exemplo n.º 20
0
 private void SendMessage(RaygunClient client, Exception exception)
 {
     if (!string.IsNullOrWhiteSpace(Tags))
     {
         var tags = Tags.Split(',');
         client.SendInBackground(exception, tags);
     }
     else
     {
         client.SendInBackground(exception);
     }
 }
Exemplo n.º 21
0
        public void SimpleSample()
        {
            RaygunClient client = new RaygunClient("6Zq4x7UB+5mdlq8eigy0Ow==");
            RaygunSettings.Settings.ThrowOnError = true;
            client.SendInBackground(new StackOverflowException("Houston, we have a problem!"));

            MyRaygunMessageBuilder message = new MyRaygunMessageBuilder()
                                                    .SetException(new StackOverflowException("Custom Stuff"))
                                                    .SetUser(new User("Gerrit Puddig",
                                                             new MailAddress("*****@*****.**")));
            client.Send(message.Build());
            //client.SendInBackground(message.Build());
        }
Exemplo n.º 22
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="apiKey">Your app api key.</param>
        /// <param name="user">An identity string for tracking affected users.</param>
        /// <param name="reportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        public static void Attach(string apiKey, string user, bool reportNativeErrors)
        {
            Detach();

            if (_client == null)
            {
                _client = new RaygunClient(apiKey);
            }

            _client.AttachCrashReporting(reportNativeErrors);

            _client.SetUserInfo(user);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Construct a sink that saves errors to the Raygun.io service. Properties are being send as userdata and the level is used as tag. The message is included inside the userdata.
        /// </summary>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="applicationKey">The application key as found on the Raygun website.</param>
        /// <param name="wrapperExceptions">If you have common outer exceptions that wrap a valuable inner exception which you'd prefer to group by, you can specify these by providing a list.</param>
        /// <param name="userNameProperty">Specifies the property name to read the username from. By default it is UserName. Set to null if you do not want to use this feature.</param>
        /// <param name="applicationVersionProperty">Specifies the property to use to retrieve the application version from. You can use an enricher to add the application version to all the log events. When you specify null, Raygun will use the assembly version.</param>
        public RaygunSink(IFormatProvider formatProvider, string applicationKey, IEnumerable<Type> wrapperExceptions = null, string userNameProperty = "UserName", string applicationVersionProperty = "ApplicationVersion")
        {
            if (string.IsNullOrEmpty(applicationKey))
                throw new ArgumentNullException("applicationKey");

            _formatProvider = formatProvider;
            _userNameProperty = userNameProperty;
            _applicationVersionProperty = applicationVersionProperty;

            _client = new RaygunClient(applicationKey);
            if (wrapperExceptions != null)
                _client.AddWrapperExceptions(wrapperExceptions);
        }
Exemplo n.º 24
0
        internal static void Detach()
        {
            if (_raygunClient != null)
            {
                DetachNotifications();

                Restore(new UIViewController(), "loadView", original_loadView_impl);
                Restore(new UIViewController(), "viewDidLoad", original_viewDidLoad_impl);
                Restore(new UIViewController(), "viewWillAppear:", original_viewWillAppear_impl);
                Restore(new UIViewController(), "viewDidAppear:", original_viewDidAppear_impl);

                _raygunClient = null;
            }
        }
Exemplo n.º 25
0
        internal static void Attach(RaygunClient raygunClient)
        {
            if (_raygunClient == null && raygunClient != null)
            {
                _raygunClient = raygunClient;

                AttachNotifications();

                Hijack(new UIViewController(), "loadView", ref original_loadView_impl, LoadViewCapture);
                Hijack(new UIViewController(), "viewDidLoad", ref original_viewDidLoad_impl, ViewDidLoadCapture);
                Hijack(new UIViewController(), "viewWillAppear:", ref original_viewWillAppear_impl, ViewWillAppearCapture);
                Hijack(new UIViewController(), "viewDidAppear:", ref original_viewDidAppear_impl, ViewDidAppearCapture);
            }
        }
Exemplo n.º 26
0
        internal static void Attach(RaygunClient raygunClient, Activity mainActivity)
        {
            if (_pulse == null && raygunClient != null && mainActivity != null && mainActivity.Application != null)
            {
                _raygunClient = raygunClient;
                _mainActivity = mainActivity;
                _pulse        = new Pulse();
                _mainActivity.Application.RegisterActivityLifecycleCallbacks(_pulse);

                _raygunClient.SendPulseSessionEvent(RaygunPulseSessionEventType.SessionStart);
                _currentActivity = _mainActivity;
                _timer.Start();
            }
        }
Exemplo n.º 27
0
        internal static void Attach(RaygunClient raygunClient)
        {
            if(_raygunClient == null && raygunClient != null)
              {
            _raygunClient = raygunClient;

            AttachNotifications();

            Hijack(new UIViewController(), "loadView", ref original_loadView_impl, LoadViewCapture);
            Hijack(new UIViewController(), "viewDidLoad", ref original_viewDidLoad_impl, ViewDidLoadCapture);
            Hijack(new UIViewController(), "viewWillAppear:", ref original_viewWillAppear_impl, ViewWillAppearCapture);
            Hijack(new UIViewController(), "viewDidAppear:", ref original_viewDidAppear_impl, ViewDidAppearCapture);
              }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        /// <returns>The RaygunClient to chain other methods.</returns>
        public RaygunClient AttachCrashReporting(bool reportNativeErrors)
        {
            Debug.WriteLine("Raygun: Initialising crash reporting");
            RaygunClient.DetachCrashReporting();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

            if (reportNativeErrors)
            {
                NativeClient = NativeRaygunClient.SharedInstanceWithApiKey(_apiKey);
            }

            return(this);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="apiKey">Your app api key.</param>
        /// <param name="user">An identity string for tracking affected users.</param>
        /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        /// <param name="hijackNativeSignals">When true, this solves the issue where null reference exceptions inside try/catch blocks crash the app, but when false, additional native errors can be reported.</param>
        public static void Attach(string apiKey, string user, bool canReportNativeErrors, bool hijackNativeSignals)
        {
            Detach();

            if (_client == null)
            {
                _client = new RaygunClient(apiKey);
            }
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

            if (canReportNativeErrors)
            {
                PopulateCrashReportDirectoryStructure();

                if (hijackNativeSignals)
                {
                    IntPtr sigbus  = Marshal.AllocHGlobal(512);
                    IntPtr sigsegv = Marshal.AllocHGlobal(512);

                    // Store Mono SIGSEGV and SIGBUS handlers
                    sigaction(Signal.SIGBUS, IntPtr.Zero, sigbus);
                    sigaction(Signal.SIGSEGV, IntPtr.Zero, sigsegv);

                    _client._reporter = Mindscape.Raygun4Net.Xamarin.iOS.Raygun.SharedReporterWithApiKey(apiKey);

                    // Restore Mono SIGSEGV and SIGBUS handlers
                    sigaction(Signal.SIGBUS, sigbus, IntPtr.Zero);
                    sigaction(Signal.SIGSEGV, sigsegv, IntPtr.Zero);

                    Marshal.FreeHGlobal(sigbus);
                    Marshal.FreeHGlobal(sigsegv);
                }
                else
                {
                    _client._reporter = Mindscape.Raygun4Net.Xamarin.iOS.Raygun.SharedReporterWithApiKey(apiKey);
                }
            }

            _client.User = user; // Set this last so that it can be passed to the native reporter.

            string deviceId = _client.DeviceId;

            if (user == null && _client._reporter != null && !String.IsNullOrWhiteSpace(deviceId))
            {
                _client._reporter.Identify(deviceId);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        /// <returns>The RaygunClient to chain other methods.</returns>
        public RaygunClient AttachCrashReporting(bool reportNativeErrors)
        {
            Debug.WriteLine("Raygun: Initialising crash reporting");
            RaygunClient.DetachCrashReporting();

            SetUnhandledExceptionHandlers();

            if (reportNativeErrors)
            {
                NativeClient = NativeRaygunClient.SharedInstanceWithApiKey(_apiKey);
            }

            SendAllStoredCrashReports();

            return(this);
        }
Exemplo n.º 31
0
        public static void LogException(Exception ex)
        {
            if (GlobalPackageSettings.ErrorReportingEnabled)
            {
                IDictionary userInfo = new Dictionary<string, string>()
                {
                    { "visual studio version", _info.VisualStudioVersion }
                };

                RaygunClient client = new RaygunClient(ApiKeys.RayGun)
                {
                    ApplicationVersion = "1.4.0"
                };

                client.Send(ex, null, userInfo);
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="apiKey">Your app api key.</param>
        /// <param name="user">An identity string for tracking affected users.</param>
        /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        /// <param name="hijackNativeSignals">When true, this solves the issue where null reference exceptions inside try/catch blocks crash the app, but when false, additional native errors can be reported.</param>
        public static void Attach(string apiKey, string user, bool canReportNativeErrors, bool hijackNativeSignals)
        {
            Detach();

            if (_client == null)
            {
                _client = new RaygunClient(apiKey);
            }

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

            if (canReportNativeErrors)
            {
                PopulateCrashReportDirectoryStructure();

                if (hijackNativeSignals)
                {
                    IntPtr sigbus  = Marshal.AllocHGlobal(512);
                    IntPtr sigsegv = Marshal.AllocHGlobal(512);

                    // Store Mono SIGSEGV and SIGBUS handlers
                    sigaction(Signal.SIGBUS, IntPtr.Zero, sigbus);
                    sigaction(Signal.SIGSEGV, IntPtr.Zero, sigsegv);

                    _client.NativeClient = NativeRaygunClient.SharedReporterWithApiKey(apiKey);

                    // Restore Mono SIGSEGV and SIGBUS handlers
                    sigaction(Signal.SIGBUS, sigbus, IntPtr.Zero);
                    sigaction(Signal.SIGSEGV, sigsegv, IntPtr.Zero);

                    Marshal.FreeHGlobal(sigbus);
                    Marshal.FreeHGlobal(sigsegv);
                }
                else
                {
                    _client.NativeClient = NativeRaygunClient.SharedReporterWithApiKey(apiKey);
                }
            }

            _client.SetUserInfo(user);
        }
Exemplo n.º 33
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        /// <param name="hijackNativeSignals">When true, this solves the issue where null reference exceptions inside try/catch blocks crash the app, but when false, additional native errors can be reported.</param>
        /// <returns>The RaygunClient to chain other methods.</returns>
        public RaygunClient AttachCrashReporting(bool canReportNativeErrors, bool hijackNativeSignals)
        {
            RaygunClient.DetachCrashReporting();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

            if (canReportNativeErrors)
            {
                PopulateCrashReportDirectoryStructure();

                if (hijackNativeSignals)
                {
                    IntPtr sigbus  = Marshal.AllocHGlobal(512);
                    IntPtr sigsegv = Marshal.AllocHGlobal(512);

                    // Store Mono SIGSEGV and SIGBUS handlers
                    sigaction(Signal.SIGBUS, IntPtr.Zero, sigbus);
                    sigaction(Signal.SIGSEGV, IntPtr.Zero, sigsegv);

                    NativeClient = NativeRaygunClient.SharedReporterWithApiKey(_apiKey);

                    // Restore Mono SIGSEGV and SIGBUS handlers
                    sigaction(Signal.SIGBUS, sigbus, IntPtr.Zero);
                    sigaction(Signal.SIGSEGV, sigsegv, IntPtr.Zero);

                    Marshal.FreeHGlobal(sigbus);
                    Marshal.FreeHGlobal(sigsegv);
                }
                else
                {
                    NativeClient = NativeRaygunClient.SharedReporterWithApiKey(_apiKey);
                }
            }
            return(this);
        }
Exemplo n.º 34
0
 public void Send(Exception e)
 {
     RaygunClient _client = new RaygunClient("EBvSU9kriUrVGUyppe8v3Q==");
     _client.Send(e);
 }
Exemplo n.º 35
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions.
 /// </summary>
 /// <param name="apiKey">Your app api key.</param>
 public static void Attach(string apiKey)
 {
   Detach();
   _client = new RaygunClient(apiKey);
   _client.SetCallingAssembly(Assembly.GetCallingAssembly());
   if (Application.Current != null)
   {
     Application.Current.UnhandledException += Current_UnhandledException;
   }
 }
Exemplo n.º 36
0
        private void SendMessage(RaygunClient client, Exception exception, IList<string> exceptionTags, IDictionary customData)
        {
            if (!string.IsNullOrWhiteSpace(Tags))
            {
                var tags = Tags.Split(',');

                foreach (string tag in tags)
                {
                    exceptionTags.Add(tag);
                }
            }

            client.SendInBackground(exception, exceptionTags, customData);
        }
Exemplo n.º 37
0
		static LoggingService ()
		{
			ConsoleLogger consoleLogger = new ConsoleLogger ();
			loggers.Add (consoleLogger);
			loggers.Add (new InstrumentationLogger ());
			
			string consoleLogLevelEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_CONSOLE_LOG_LEVEL");
			if (!string.IsNullOrEmpty (consoleLogLevelEnv)) {
				try {
					consoleLogger.EnabledLevel = (EnabledLoggingLevel) Enum.Parse (typeof (EnabledLoggingLevel), consoleLogLevelEnv, true);
				} catch {}
			}
			
			string consoleLogUseColourEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_CONSOLE_LOG_USE_COLOUR");
			if (!string.IsNullOrEmpty (consoleLogUseColourEnv) && consoleLogUseColourEnv.ToLower () == "false") {
				consoleLogger.UseColour = false;
			} else {
				consoleLogger.UseColour = true;
			}
			
			string logFileEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_LOG_FILE");
			if (!string.IsNullOrEmpty (logFileEnv)) {
				try {
					FileLogger fileLogger = new FileLogger (logFileEnv);
					loggers.Add (fileLogger);
					string logFileLevelEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_FILE_LOG_LEVEL");
					fileLogger.EnabledLevel = (EnabledLoggingLevel) Enum.Parse (typeof (EnabledLoggingLevel), logFileLevelEnv, true);
				} catch (Exception e) {
					LogError (e.ToString ());
				}
			}

			timestamp = DateTime.Now;

			string raygunKey = BrandingService.GetString ("RaygunApiKey");
			if (raygunKey != null) {
				raygunClient = new RaygunClient (raygunKey);
			}

			//remove the default trace listener on .NET, it throws up horrible dialog boxes for asserts
			System.Diagnostics.Debug.Listeners.Clear ();

			//add a new listener that just logs failed asserts
			System.Diagnostics.Debug.Listeners.Add (new AssertLoggingTraceListener ());
		}
 public ReportMessageCommand(IWindowManagerEx windowManager)
 {
     this.windowManager = windowManager;
     client = RaygunUtility.GetClient();
 }
Exemplo n.º 39
0
        internal static void Detach()
        {
            if(_raygunClient != null) {
            DetachNotifications();

            Restore(new UIViewController(), "loadView", original_loadView_impl);
            Restore(new UIViewController(), "viewDidLoad", original_viewDidLoad_impl);
            Restore(new UIViewController(), "viewWillAppear:", original_viewWillAppear_impl);
            Restore(new UIViewController(), "viewDidAppear:", original_viewDidAppear_impl);

            _raygunClient = null;
              }
        }
 static ExceptionHandler()
 {
     client = RaygunUtility.GetClient();
 }
Exemplo n.º 41
0
 public static void HandleException(Exception exception)
 {
     var apiKey = "";//TODO: set your Raygun ApiKey
     var raygunClient = new RaygunClient(apiKey);
     raygunClient.Send(exception);
 }
Exemplo n.º 42
0
 internal static void Detach()
 {
     if (_pulse != null && _mainActivity != null && _mainActivity.Application != null)
       {
     _mainActivity.Application.UnregisterActivityLifecycleCallbacks(_pulse);
     _mainActivity = null;
     _currentActivity = null;
     _pulse = null;
     _raygunClient = null;
       }
 }
Exemplo n.º 43
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
 /// </summary>
 /// <param name="apiKey">Your app api key.</param>
 public static void Attach(string apiKey)
 {
     Detach();
       _client = new RaygunClient(apiKey);
       AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
       TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
       AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
 }
Exemplo n.º 44
0
 /// <summary>
 /// Initializes the static RaygunClient with the given Raygun api key.
 /// </summary>
 /// <param name="apiKey">Your Raygun api key for this application.</param>
 /// <returns>The RaygunClient to chain other methods.</returns>
 public static RaygunClient Initialize(string apiKey)
 {
     if(_client == null) {
     _client = new RaygunClient(apiKey);
       }
       return _client;
 }
Exemplo n.º 45
0
        internal static void Attach(RaygunClient raygunClient, Activity mainActivity)
        {
            if (_pulse == null && raygunClient != null && mainActivity != null && mainActivity.Application != null)
              {
            _raygunClient = raygunClient;
            _mainActivity = mainActivity;
            _pulse = new Pulse();
            _mainActivity.Application.RegisterActivityLifecycleCallbacks(_pulse);

            _raygunClient.SendPulseSessionEvent(RaygunPulseSessionEventType.SessionStart);
            _currentActivity = _mainActivity;
            _timer.Start();
              }
        }
Exemplo n.º 46
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="apiKey">Your app api key.</param>
        /// <param name="user">An identity string for tracking affected users.</param>
        /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param>
        /// <param name="hijackNativeSignals">When true, this solves the issue where null reference exceptions inside try/catch blocks crash the app, but when false, additional native errors can be reported.</param>
        public static void Attach(string apiKey, string user, bool canReportNativeErrors, bool hijackNativeSignals)
        {
            Detach();

              _client = new RaygunClient(apiKey);
              AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
              TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

              if (canReportNativeErrors)
              {
            PopulateCrashReportDirectoryStructure();

            if (hijackNativeSignals)
            {
              IntPtr sigbus = Marshal.AllocHGlobal (512);
              IntPtr sigsegv = Marshal.AllocHGlobal (512);

              // Store Mono SIGSEGV and SIGBUS handlers
              sigaction (Signal.SIGBUS, IntPtr.Zero, sigbus);
              sigaction (Signal.SIGSEGV, IntPtr.Zero, sigsegv);

              _client._reporter = Mindscape.Raygun4Net.Xamarin.iOS.Raygun.SharedReporterWithApiKey (apiKey);

              // Restore Mono SIGSEGV and SIGBUS handlers
              sigaction (Signal.SIGBUS, sigbus, IntPtr.Zero);
              sigaction (Signal.SIGSEGV, sigsegv, IntPtr.Zero);

              Marshal.FreeHGlobal (sigbus);
              Marshal.FreeHGlobal (sigsegv);
            }
            else
            {
              _client._reporter = Mindscape.Raygun4Net.Xamarin.iOS.Raygun.SharedReporterWithApiKey (apiKey);
            }
              }

              _client.User = user; // Set this last so that it can be passed to the native reporter.

              string deviceId = _client.DeviceId;
              if (user == null && _client._reporter != null && !String.IsNullOrWhiteSpace(deviceId))
              {
            _client._reporter.Identify(deviceId);
              }
        }
Exemplo n.º 47
0
 /// <summary>
 /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
 /// </summary>
 /// <param name="apiKey">Your app api key.</param>
 /// <param name="user">An identity string for tracking affected users.</param>
 public static void Attach(string apiKey, string user)
 {
     Detach();
       _client = new RaygunClient(apiKey) { User = user };
       AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
       TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
 }
Exemplo n.º 48
0
        static void Main(string[] args)
        {
            if (RaygunKey[0] != '{')
                Raygun = new RaygunClient (RaygunKey);

            AppDomain.CurrentDomain.UnhandledException += (sender, e) => {
                if (StartupLog != null)
                    StartupLog.Error ("Fatal Error", (Exception)e.ExceptionObject);

                if (Raygun != null)
                    Raygun.Send ((Exception) e.ExceptionObject, null, Settings.CurrentSettings);

                MessageBox.Show ("Unexpected error" + Environment.NewLine + (e.ExceptionObject as Exception).ToDisplayString(),
                                 "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            };

            //AutomaticErrorReporter errors = new AutomaticErrorReporter();
            //errors.Add (new GablarskiErrorReporter (typeof(Program).Assembly));

            log4net.Config.XmlConfigurator.Configure ();
            StartupLog = LogManager.GetLogger ("Startup");
            StartupLog.DebugFormat ("PID: {0}", Process.GetCurrentProcess().Id);

            FileInfo program = new FileInfo (Process.GetCurrentProcess().MainModule.FileName);
            Environment.CurrentDirectory = program.Directory.FullName;

            string useLocalValue = ConfigurationManager.AppSettings["useLocalDatabase"];
            bool useLocal;
            Boolean.TryParse (useLocalValue, out useLocal);

            StartupLog.DebugFormat ("Local files: {0}", useLocal);
            StartupLog.DebugFormat ("Setting up databases..");

            ClientData.Setup (useLocal);

            StartupLog.DebugFormat ("Databases setup.");

            CheckForUpdates();

            StartupLog.Debug ("Starting key retrieval");
            var keyCancelSource = new CancellationTokenSource();
            Key = ClientData.GetCryptoKeyAsync (keyCancelSource.Token);
            Key.ContinueWith (t => StartupLog.DebugFormat ("Key retrieval: {0}{1}{2}", t.Status, Environment.NewLine, t.Exception));

            SetupFirstRun();

            if (Settings.Nickname == null)
                PersonalSetup();

            if (!ShowKeyProgress (keyCancelSource))
                return;

            ResourceWebRequestFactory.Register();

            Application.EnableVisualStyles ();
            Application.SetCompatibleTextRenderingDefault (false);

            //SetupSocial();

            /*MainWindow window = new MainWindow();
            window.Show();*/

            var m = new MainForm();
            m.Show();

            UpdateTaskbarServers();

            if (args.Length > 0) {
                int id;
                if (Int32.TryParse (args[0], out id)) {
                    ServerEntry server = Servers.GetEntries ().FirstOrDefault (s => s.Id == id);
                    if (server == null) {
                        if (!m.ShowConnect (true))
                            return;
                    } else
                        m.Connect (server);
                } else {
                    Uri server = new Uri (args[0]);
                    m.Connect (server.Host, (server.Port != -1) ? server.Port : 42912);
                }
            } else if (Settings.ShowConnectOnStart) {
                if (!m.ShowConnect (true))
                    return;
            }

            /*System.Windows.Application app = new System.Windows.Application();
            app.Run (window);*/

            Application.Run (m);

            Settings.Save();
        }