Exemplo n.º 1
0
        public Client(INativeClient nativeClient)
        {
            MainThread          = Thread.CurrentThread;
            ForegroundStopwatch = new Stopwatch();
            BackgroundStopwatch = new Stopwatch();
            NativeClient        = nativeClient;
            User = new User {
                Id = SystemInfo.deviceUniqueIdentifier
            };
            Middleware      = new List <Middleware>();
            Metadata        = new Metadata(nativeClient);
            UniqueCounter   = new UniqueLogThrottle(Configuration);
            LogTypeCounter  = new MaximumLogTypeCounter(Configuration);
            SessionTracking = new SessionTracker(this);
            UnityMetadata.InitDefaultMetadata();
            Device.InitUnityVersion();
            NativeClient.SetMetadata(UnityMetadataKey, UnityMetadata.ForNativeClient());

            NativeClient.PopulateUser(User);

            SceneManager.sceneLoaded += SceneLoaded;
            Application.logMessageReceivedThreaded += MultiThreadedNotify;
            Application.logMessageReceived         += Notify;
            User.PropertyChanged += (obj, args) => { NativeClient.SetUser(User); };
            TimingTrackerObject   = new GameObject("Bugsnag app lifecycle tracker");
            TimingTrackerObject.AddComponent <TimingTrackerBehaviour>();
            // Run initial session check in next frame to allow potential configuration
            // changes to be completed first.
            try {
                var asyncHandler = MainThreadDispatchBehaviour.Instance();
                asyncHandler.Enqueue(RunInitialSessionCheck());
            } catch (System.Exception ex) {
                // Async behavior is not available in a test environment
            }
        }
Exemplo n.º 2
0
        public Client(INativeClient nativeClient)
        {
            Stopwatch    = new Stopwatch();
            NativeClient = nativeClient;
            User         = new User {
                Id = SystemInfo.deviceUniqueIdentifier
            };
            Middleware      = new List <Middleware>();
            Metadata        = new Metadata();
            UniqueCounter   = new UniqueLogThrottle(Configuration);
            LogTypeCounter  = new MaximumLogTypeCounter(Configuration);
            SessionTracking = new SessionTracker(this);
            NativeClient.SetMetadata(UnityMetadataKey, UnityMetadata.ForNativeClient());

            NativeClient.PopulateUser(User);

            SceneManager.sceneLoaded += SceneLoaded;
            Application.logMessageReceivedThreaded += Notify;
        }