예제 #1
0
 private IHealthNotifier BuildHealthNotifier(HealthNotifierBuilderSettings builderSettings, ILogFactory logFactory)
 {
     return(new HealthNotifier(builderSettings.AppName,
                               builderSettings.AppVersion,
                               builderSettings.EnvInfo ?? "?",
                               logFactory,
                               _slackNotificationsSender));
 }
예제 #2
0
        public IHealthNotifier GetOrCreateHealthNotifier(string appName, string appVersion, string envInfo, ILogFactory logFactory)
        {
            var builderSettings = new HealthNotifierBuilderSettings(appName, appVersion, envInfo);

            return(_healthNotifiers.GetOrAdd(builderSettings, p =>
            {
                return new Lazy <IHealthNotifier>(() =>
                {
                    _log.Info($"Registering health notifier: appName {p.AppName}, appVersion {p.AppVersion}, envInfo {p.EnvInfo}");

                    return BuildHealthNotifier(builderSettings, logFactory);
                });
            }).Value);
        }