Exemple #1
0
        /// <summary>
        ///   Write out any notifications to listeners.
        /// </summary>
        /// <param name="status">The result of a health check execution.</param>
        public void NotifyListeners(IHealthStatus status)
        {
            if (status.Timestamp == DateTime.MinValue)
            {
                status.Timestamp = DateTime.Now;
            }

            foreach (var listener in Listeners)
            {
                try
                {
                    if (status.Status >= listener.Threshold)
                    {
                        listener.Process(status);
                    }
                }
                catch (Exception ex)
                {
                    _log.Error("Error Publishing Status To Listener: {0}", ex.ToString(), ex);
                }
            }
        }
            public bool Process(IHealthStatus status)
            {
                _log.Warn(status.Status);

                return(true);
            }
 /// <summary>
 ///   Process a health check result.
 /// </summary>
 /// <param name="status">The status of a health check.</param>
 /// <returns><c>true</c> if the listener processed the status; otherwise, <c>false</c></returns>
 public bool Process(IHealthStatus status)
 {
     _log.Debug($"NullListener: {status.Plugin.Name}: {status.StatusCode} - {status.Status}");
     return(true);
 }