Exemple #1
0
 private void WriteLog(PulseEventSource pulseEventSource, HeartbeatStatus status, string logText)
 {
     if (HeartbeatConfiguration.Current.Enabled)
     {
         var log = new HeartbeatLog();
         log.LogDate             = DateTime.Now;
         log.Status              = status;
         log.HeartbeatInstanceId = HeartbeatInstanceId;
         log.ComponentTypeName   = _intiatingTypeName;
         log.LogText             = logText;
         if (pulseEventSource != PulseEventSource.Count)
         {
             log.PulseTimerInterval = PulseTimerInterval;
             log.TimerPulseNumber   = _timerPulseNumber;
             log.TimerMilliseconds  = _timerMilliseconds;
         }
         if (pulseEventSource != PulseEventSource.Timer)
         {
             log.PulseCountInterval = PulseCountInterval;
             log.CountPulseNumber   = _countPulseNumber;
             log.CountNumber        = _count;
         }
         HeartbeatRepository.WriteHeartbeatLog(log);
     }
 }
Exemple #2
0
        private void Pulse(PulseEventSource pulseEventSource)
        {
            if (HeartbeatConfiguration.Current.Enabled)
            {
                switch (pulseEventSource)
                {
                case PulseEventSource.Count:
                    lock (_countPulseSyncLock)
                    {
                        _countPulseNumber++;
                    }
                    break;

                case PulseEventSource.Timer:
                    lock (_timerPulseSyncLock)
                    {
                        _timerPulseNumber++;
                    }
                    break;
                }
                var writeLog = true;
                var logText  = string.Empty;
                if (OnPulse != null)
                {
                    OnPulse(pulseEventSource, ref writeLog, ref logText);
                }
                if (writeLog)
                {
                    WriteLog(pulseEventSource, HeartbeatStatus.InProgress, logText);
                }
            }
        }
Exemple #3
0
 private void WriteLog(PulseEventSource pulseEventSource, HeartbeatStatus status, string logText)
 {
     if (HeartbeatConfiguration.Current.Enabled)
     {
         var log = new HeartbeatLog();
         log.LogDate = DateTime.Now;
         log.Status = status;
         log.HeartbeatInstanceId = HeartbeatInstanceId;
         log.ComponentTypeName = _intiatingTypeName;
         log.LogText = logText;
         if (pulseEventSource != PulseEventSource.Count)
         {
             log.PulseTimerInterval = PulseTimerInterval;
             log.TimerPulseNumber = _timerPulseNumber;
             log.TimerMilliseconds = _timerMilliseconds;
         }
         if (pulseEventSource != PulseEventSource.Timer)
         {
             log.PulseCountInterval = PulseCountInterval;
             log.CountPulseNumber = _countPulseNumber;
             log.CountNumber = _count;
         }
         HeartbeatRepository.WriteHeartbeatLog(log);
     }
 }
Exemple #4
0
 private void Pulse(PulseEventSource pulseEventSource)
 {
     if (HeartbeatConfiguration.Current.Enabled)
     {
         switch (pulseEventSource)
         {
             case PulseEventSource.Count:
                 lock (_countPulseSyncLock)
                 {
                     _countPulseNumber++;
                 }
                 break;
             case PulseEventSource.Timer:
                 lock (_timerPulseSyncLock)
                 {
                     _timerPulseNumber++;
                 }
                 break;
         }
         var writeLog = true;
         var logText = string.Empty;
         if (OnPulse != null)
         {
             OnPulse(pulseEventSource, ref writeLog, ref logText);
         }
         if (writeLog)
         {
             WriteLog(pulseEventSource, HeartbeatStatus.InProgress, logText);
         }
     }
 }
 void RunTimer_OnPulse(PulseEventSource source, ref bool writeLog, ref string logText)
 {
     writeLog = true;
     logText = "RunTimer_OnPulse, source: {0}, text: {1}"
                 .FormatWith(source, RandomValueGenerator.GetRandomString());
 }
Exemple #6
0
 void RunTimer_OnPulse(PulseEventSource source, ref bool writeLog, ref string logText)
 {
     writeLog = true;
     logText  = "RunTimer_OnPulse, source: {0}, text: {1}"
                .FormatWith(source, RandomValueGenerator.GetRandomString());
 }