예제 #1
0
        public BugsnagClient(string apiKey, bool enableMetrics = true)
        {
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            this.apiKey = apiKey;
            sendMetrics = enableMetrics;
            AutoNotify  = true;

            // Install exception handlers
            interceptors = new IDisposable[] {
                new AppDomainInterceptor(this),
                new TaskSchedulerInterceptor(this),
            };

            state              = new StateCacher(new StateReporter(this));
            stateTracker       = new StateTracker();
            exceptionConverter = new ExceptionConverter(this);
            notifier           = new Notifier(this, MakeErrorCacheDir());

            // Register observers init observer
            notifApplicationDidBecomeActive = NSNotificationCenter.DefaultCenter.AddObserver(
                UIApplication.DidBecomeActiveNotification, OnApplicationDidBecomeActive);
        }
예제 #2
0
        public BugsnagClient(Context context, string apiKey, bool enableMetrics = true)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            context = context.ApplicationContext;

            this.apiKey  = apiKey;
            sendMetrics  = enableMetrics;
            ReleaseStage = GuessReleaseStage(context);
            AutoNotify   = true;

            // Install exception handlers
            interceptors = new IDisposable[] {
                new AppDomainInterceptor(this),
                new TaskSchedulerInterceptor(this),
                new AndroidInterceptor(this),
            };

            state              = new StateCacher(new StateReporter(this, context));
            activityTracker    = new ActivityTracker();
            exceptionConverter = new ExceptionConverter(this);
            notifier           = new Notifier(this, MakeErrorCacheDir(context));
        }