コード例 #1
0
        public void LogMessageAtStartup()
        {
            var logCapture = Logs.Capture();
            var logger     = logCapture.Logger("BaseLoggerName"); // in real life, the SDK will provide its own base log name
            var context    = new LdClientContext(new BasicConfiguration("", false, logger),
                                                 LaunchDarkly.Sdk.Server.Configuration.Default(""));

            using (Consul.DataStore().Address("http://localhost:8500").Prefix("my-prefix")
                   .CreatePersistentDataStore(context))
            {
                Assert.Collection(logCapture.GetMessages(),
                                  m =>
                {
                    Assert.Equal(LaunchDarkly.Logging.LogLevel.Info, m.Level);
                    Assert.Equal("BaseLoggerName.DataStore.Consul", m.LoggerName);
                    Assert.Equal("Using Consul data store at http://localhost:8500/ with prefix \"my-prefix\"",
                                 m.Text);
                });
            }
        }
コード例 #2
0
 private IPersistentDataStoreAsyncFactory MakeStoreFactory(string prefix) =>
 Consul.DataStore().Prefix(prefix);