public void Status() { var log = new HeartbeatLog(); log.StatusCode = "START"; Assert.AreEqual(HeartbeatStatus.Started, log.Status); log.Status = HeartbeatStatus.InProgress; Assert.AreEqual("WORKING", log.StatusCode); }
/// <summary> /// Create a new HeartbeatLog object. /// </summary> /// <param name="heartbeatLogId">Initial value of the HeartbeatLogId property.</param> /// <param name="heartbeatInstanceId">Initial value of the HeartbeatInstanceId property.</param> /// <param name="componentTypeName">Initial value of the ComponentTypeName property.</param> /// <param name="statusCode">Initial value of the StatusCode property.</param> /// <param name="logDate">Initial value of the LogDate property.</param> public static HeartbeatLog CreateHeartbeatLog(global::System.Int32 heartbeatLogId, global::System.Guid heartbeatInstanceId, global::System.String componentTypeName, global::System.String statusCode, global::System.DateTime logDate) { HeartbeatLog heartbeatLog = new HeartbeatLog(); heartbeatLog.HeartbeatLogId = heartbeatLogId; heartbeatLog.HeartbeatInstanceId = heartbeatInstanceId; heartbeatLog.ComponentTypeName = componentTypeName; heartbeatLog.StatusCode = statusCode; heartbeatLog.LogDate = logDate; return(heartbeatLog); }
/// <summary> /// Writes a new heartbeat log entry /// </summary> /// <param name="log">Log entry</param> public static void WriteHeartbeatLog(HeartbeatLog log) { try { using (var context = GetContext()) { context.AddToHeartbeatLogs(log); context.SaveChanges(); } } catch (Exception ex) { Log.Error(() => "Exception writing heartbeat log: {0}, message: {1}" .FormatWith(log, ex.FullMessage())); } }
/// <summary> /// Deprecated Method for adding a new object to the HeartbeatLogs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToHeartbeatLogs(HeartbeatLog heartbeatLog) { base.AddObject("HeartbeatLogs", heartbeatLog); }
/// <summary> /// Create a new HeartbeatLog object. /// </summary> /// <param name="heartbeatLogId">Initial value of the HeartbeatLogId property.</param> /// <param name="heartbeatInstanceId">Initial value of the HeartbeatInstanceId property.</param> /// <param name="componentTypeName">Initial value of the ComponentTypeName property.</param> /// <param name="statusCode">Initial value of the StatusCode property.</param> /// <param name="logDate">Initial value of the LogDate property.</param> public static HeartbeatLog CreateHeartbeatLog(global::System.Int32 heartbeatLogId, global::System.Guid heartbeatInstanceId, global::System.String componentTypeName, global::System.String statusCode, global::System.DateTime logDate) { HeartbeatLog heartbeatLog = new HeartbeatLog(); heartbeatLog.HeartbeatLogId = heartbeatLogId; heartbeatLog.HeartbeatInstanceId = heartbeatInstanceId; heartbeatLog.ComponentTypeName = componentTypeName; heartbeatLog.StatusCode = statusCode; heartbeatLog.LogDate = logDate; return heartbeatLog; }
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); } }