Ejemplo n.º 1
0
        public void HandleEnqueuingStartSessionLog()
        {
            _sessionTracker.Pause();
            var sessionLog = new StartSessionLog();
            var eventArgs  = new EnqueuingLogEventArgs(sessionLog);

            _mockChannelGroup.Raise(group => group.EnqueuingLog += null, null, eventArgs);

            _mockChannel.Verify(channel => channel.EnqueueAsync(It.IsAny <StartSessionLog>()), Times.Never());
        }
Ejemplo n.º 2
0
        public void HandleEnqueuingLogOutsideSession()
        {
            _sessionTracker.Pause();
            var eventLog = new EventLog {
                Name = "thisisaneventlog"
            };
            var eventArgs = new EnqueuingLogEventArgs(eventLog);

            _mockChannelGroup.Raise(group => group.EnqueuingLog += null, null, eventArgs);

            _mockChannel.Verify(channel => channel.EnqueueAsync(It.IsAny <StartSessionLog>()), Times.Once());
            Assert.IsNotNull(eventLog.Sid);
        }
Ejemplo n.º 3
0
 private void HandleEnqueuingLog(object sender, EnqueuingLogEventArgs e)
 {
     lock (_lockObject)
     {
         // Skip StartSessionLogs to avoid an infinite loop
         // Skip StartServiceLog because enqueuing a startservicelog should not trigger the start of a session
         if (e.Log is StartSessionLog || e.Log is StartServiceLog)
         {
             return;
         }
         e.Log.Sid          = _sid;
         _lastQueuedLogTime = TimeHelper.CurrentTimeInMilliseconds();
     }
 }
 private void HandleEnqueuingLog(object sender, EnqueuingLogEventArgs e)
 {
     lock (_lockObject)
     {
         // Skip StartSessionLogs to avoid an infinite loop
         // Skip StartServiceLog because enqueuing a startservicelog should not trigger the start of a session
         if (e.Log is StartSessionLog || e.Log is StartServiceLog)
         {
             return;
         }
         if (SetExistingSessionId(e.Log, _sessions))
         {
             return;
         }
         SendStartSessionIfNeeded();
         e.Log.Sid          = _sid == Guid.Empty ? null : new Guid?(_sid);
         _lastQueuedLogTime = TimeHelper.CurrentTimeInMilliseconds();
     }
 }
Ejemplo n.º 5
0
        private void HandleEnqueuingLog(object sender, EnqueuingLogEventArgs e)
        {
            lock (_lockObject)
            {
                // Skip StartSessionLogs to avoid an infinite loop
                // Skip StartServiceLog because enqueuing a startservicelog should not trigger the start of a session
                if (e.Log is StartSessionLog || e.Log is StartServiceLog)
                {
                    return;
                }

                // Correlate current session only to logs not specifying timestamps.
                // Crash before restart when Analytics was disabled at that time must not have session identifier.
                if (e.Log.Timestamp == null)
                {
                    e.Log.Sid = SessionContext.SessionId;
                }

                _lastQueuedLogTime = TimeHelper.CurrentTimeInMilliseconds();
            }
        }