当前位置: 首页>>代码示例>>C#>>正文


C# ObservableEventListener.LogToWindowsAzureTable方法代码示例

本文整理汇总了C#中ObservableEventListener.LogToWindowsAzureTable方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableEventListener.LogToWindowsAzureTable方法的具体用法?C# ObservableEventListener.LogToWindowsAzureTable怎么用?C# ObservableEventListener.LogToWindowsAzureTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObservableEventListener的用法示例。


在下文中一共展示了ObservableEventListener.LogToWindowsAzureTable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnableLoggingListener

 private void EnableLoggingListener()
 {
     listener = new ObservableEventListener();
     listener.LogToWindowsAzureTable("CustomEvents", "DefaultEndpointsProtocol=https;AccountName=musiccloudstorage;AccountKey=...");
     //listener.EnableEvents(AuditEvent.Log, EventLevel.LogAlways, Keywords.All);
     listener.EnableEvents(ErrorEvent.Log, EventLevel.LogAlways, Keywords.All);
 }
开发者ID:dmossberg,项目名称:MusicStoreMvcSource,代码行数:7,代码来源:Global.asax.cs

示例2: Initialize

        public override void Initialize()
        {
            var eventListener = new ObservableEventListener();

            eventListener.EnableEvents(
                VirtoCommerceEventSource.Log,
                EventLevel.LogAlways,
                Keywords.All);

            

            var assetsConnection = ConfigurationManager.ConnectionStrings["AssetsConnectionString"];

            if (assetsConnection != null)
            {
                var properties = assetsConnection.ConnectionString.ToDictionary(";", "=");
                var provider = properties["provider"];
                var assetsConnectionString = properties.ToString(";", "=", "provider");

                if (string.Equals(provider, FileSystemBlobProvider.ProviderName, StringComparison.OrdinalIgnoreCase))
                {
                    eventListener.LogToRollingFlatFile("AvaTax.log",
                        10000,
                        "hh",
                        RollFileExistsBehavior.Increment,
                        RollInterval.Day);
                }
                else
                    if (string.Equals(provider, AzureBlobProvider.ProviderName, StringComparison.OrdinalIgnoreCase))
                    {
                        eventListener.LogToWindowsAzureTable(
                            "VirtoCommerce2", assetsConnectionString);

                    }
            }


            var settingsManager = _container.Resolve<ISettingsManager>();
            
            var avalaraTax = new AvaTaxSettings(_usernamePropertyName, _passwordPropertyName, _serviceUrlPropertyName, _companyCodePropertyName, _isEnabledPropertyName, _isValidateAddressPropertyName, settingsManager);
            
            _container.RegisterType<AvaTaxController>
                (new InjectionConstructor(
                    avalaraTax));

            _container.RegisterInstance<ITaxSettings>(avalaraTax);

            //Subscribe to cart changes. Calculate taxes   
            _container.RegisterType<IObserver<CartChangeEvent>, CalculateCartTaxesObserver>("CalculateCartTaxesObserver");

            //Subscribe to order changes. Calculate taxes   
            _container.RegisterType<IObserver<OrderChangeEvent>, CalculateOrderTaxesObserver>("CalculateOrderTaxesObserver");

            //Subscribe to order changes. Calculate taxes   
            _container.RegisterType<IObserver<OrderChangeEvent>, CancelOrderTaxesObserver>("CancelOrderTaxesObserver");

            //Subscribe to order changes. Adjust taxes   
            _container.RegisterType<IObserver<OrderChangeEvent>, CalculateTaxAdjustmentObserver>("CalculateTaxAdjustmentObserver");
        }
开发者ID:rajendra1809,项目名称:VirtoCommerce,代码行数:59,代码来源:Module.cs

示例3: RegisterEFLogger

        private static void RegisterEFLogger()
        {
            var listener = new ObservableEventListener();
            listener.EnableEvents(EFLogging.Logger, EventLevel.LogAlways, Keywords.All);

            listener.LogToFlatFile("EFSqls.log");
            listener.LogToWindowsAzureTable(instanceName: "Protiviti", connectionString: "UseDevelopmentStorage=true",tableAddress:"EFSqls");
        }
开发者ID:szwork2013,项目名称:BoiPlt,代码行数:8,代码来源:Bootstrapper.cs

示例4: RegisterLogger

        private static void RegisterLogger()
        {
            var listener = new ObservableEventListener();
            listener.EnableEvents(WebApiTracing.Log, EventLevel.LogAlways, Keywords.All);

            listener.LogToConsole();
            listener.LogToFlatFile("test.log");
            listener.LogToWindowsAzureTable(instanceName: "Protiviti", connectionString: "UseDevelopmentStorage=true");
        }
开发者ID:szwork2013,项目名称:BoiPlt,代码行数:9,代码来源:Bootstrapper.cs

示例5: RunAsync

        async Task RunAsync(CancellationToken cancellationToken)
        {
            var settingsProvider = new RoleEnvironmentSettingsProvider();

            var eventListener = new ObservableEventListener();
            eventListener.LogToWindowsAzureTable(RoleEnvironment.CurrentRoleInstance.Id, settingsProvider.GetSetting("BlobSessionStatePersistenceProvider.StorageConnectionString"), bufferingInterval: TimeSpan.FromMinutes(2));
            eventListener.EnableEvents(BootstrapperEventSource.Log, EventLevel.Informational);
            eventListener.EnableEvents(MqttIotHubAdapterEventSource.Log, EventLevel.Informational);
            eventListener.EnableEvents(DefaultEventSource.Log, EventLevel.Informational);
            
            int minWorkerThreads;
            int minCompletionPortThreads;
            ThreadPool.GetMinThreads(out minWorkerThreads, out minCompletionPortThreads);
            ThreadPool.SetMinThreads(minWorkerThreads, Math.Max(16, minCompletionPortThreads));

            int threadCount = Environment.ProcessorCount;
            
            BlobSessionStatePersistenceProvider blobSessionStateProvider =
                await BlobSessionStatePersistenceProvider.CreateAsync(
                    settingsProvider.GetSetting("BlobSessionStatePersistenceProvider.StorageConnectionString"),
                    settingsProvider.GetSetting("BlobSessionStatePersistenceProvider.StorageContainerName"));

            TableQos2StatePersistenceProvider tableQos2StateProvider =
                await TableQos2StatePersistenceProvider.CreateAsync(
                    settingsProvider.GetSetting("TableQos2StatePersistenceProvider.StorageConnectionString"),
                    settingsProvider.GetSetting("TableQos2StatePersistenceProvider.StorageTableName"));

            var bootstrapper = new Bootstrapper(
                settingsProvider,
                blobSessionStateProvider,
                tableQos2StateProvider);

            X509Certificate2 tlsCertificate = GetTlsCertificate(settingsProvider.GetSetting("TlsCertificateThumbprint"),
                StoreName.My, StoreLocation.LocalMachine);

            try
            {
                await bootstrapper.RunAsync(tlsCertificate, threadCount, cancellationToken);
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());
                throw;
            }
            await bootstrapper.CloseCompletion;
        }
开发者ID:troyanov,项目名称:azure-iot-protocol-gateway,代码行数:46,代码来源:WorkerRole.cs

示例6: Main

        static void Main(string[] args)
        {
            ObservableEventListener listener1;
            try
            {
                listener1 = new ObservableEventListener();
                var conString =
                    $"DefaultEndpointsProtocol={CloudStorageAccount.DevelopmentStorageAccount.TableEndpoint.Scheme};" +
                    $"AccountName={CloudStorageAccount.DevelopmentStorageAccount.Credentials.AccountName};" +
                    $"AccountKey={Convert.ToBase64String(CloudStorageAccount.DevelopmentStorageAccount.Credentials.ExportKey())}";

                listener1.LogToWindowsAzureTable( // <---- EXCEPTION HERE
                        instanceName: "instName",
                        connectionString: conString);

                listener1.EnableEvents(MyCompanyEventSource.Log, EventLevel.LogAlways,
                    MyCompanyEventSource.Keywords.Perf | MyCompanyEventSource.Keywords.Diagnostic |
                    MyCompanyEventSource.Keywords.Page | MyCompanyEventSource.Keywords.DataBase);
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:CassandraDied,项目名称:SemanticLoggingAzureExceptionExample,代码行数:24,代码来源:Program.cs

示例7: RunAsync

        private async Task RunAsync(CancellationToken cancellationToken)
        {
            var eventListener = new ObservableEventListener();
            eventListener.LogToWindowsAzureTable(
                _configuration.Identifier,
                _configuration.StorageConnectionString);

            eventListener.EnableEvents(DefaultEventSource.Log, EventLevel.Informational);
            eventListener.EnableEvents(ByteBlasterEventSource.Log, EventLevel.Informational);

            var eventHubClient = EventHubClient.CreateFromConnectionString(
                _configuration.EventHubConnectionString,
                _configuration.EventHubName);

            var byteBlasterClient = new ByteBlasterClient(_configuration.Email);

            // Subscribe and send Quick Block Transfer Segments to the Event Hub
            byteBlasterClient
                .Subscribe(async e => await Publish(eventHubClient, e));

            _log.InfoFormat("Starting EMWIN ByteBlaster Client");
            await byteBlasterClient.StartAsync(cancellationToken);

            eventHubClient.Close();
        }
开发者ID:bradsjm,项目名称:DotEmwin,代码行数:25,代码来源:EventPubService.cs

示例8: CreateListener

 /// <summary>
 /// Creates an event listener that logs using a <see cref="WindowsAzureTableSink" />.
 /// </summary>
 /// <param name="instanceName">The name of the instance originating the entries.</param>
 /// <param name="connectionString">The connection string for the storage account.</param>
 /// <param name="tableAddress">Either the name of the table, or the absolute URI to the table.</param>
 /// <param name="bufferingInterval">The buffering interval between each batch publishing.</param>
 /// <param name="sortKeysAscending">The value indicating whether to sort the row keys in ascending order.</param>
 /// <param name="listenerDisposeTimeout">Defines a timeout interval for the flush operation when the listener is disposed.</param>
 /// <param name="maxBufferSize">The maximum number of entries that can be buffered while it's sending to Windows Azure Storage before the sink starts dropping entries.
 /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Calling <see cref="IDisposable.Dispose" /> on
 /// the <see cref="EventListener" /> will block until all the entries are flushed or the interval elapses.
 /// If <see langword="null" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>
 /// <returns>
 /// An event listener that uses <see cref="WindowsAzureTableSink" /> to log events.
 /// </returns>
 public static EventListener CreateListener(string instanceName, string connectionString, string tableAddress = DefaultTableName, TimeSpan? bufferingInterval = null, bool sortKeysAscending = false, TimeSpan? listenerDisposeTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize)
 {
     var listener = new ObservableEventListener();
     listener.LogToWindowsAzureTable(instanceName, connectionString, tableAddress, bufferingInterval, sortKeysAscending, listenerDisposeTimeout, maxBufferSize);
     return listener;
 }
开发者ID:Brar,项目名称:entlib,代码行数:22,代码来源:WindowsAzureTableLog.cs

示例9: WhenInstanceIsNull

        public void WhenInstanceIsNull()
        {
            var ex = ExceptionAssertHelper.Throws<ArgumentNullException>(() =>
            {
                var connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageConnectionString"];

                using (var listener = new ObservableEventListener())
                {
                    listener.LogToWindowsAzureTable(null, connectionString);
                }
            });

            StringAssert.Contains(ex.Message, "Value cannot be null");
            StringAssert.Contains(ex.Message, "Parameter name: instanceName");
        }
开发者ID:husains,项目名称:semantic-logging,代码行数:15,代码来源:WindowsAzureTableSinkFixture.cs

示例10: WhenConnectionStringIsNull

        public void WhenConnectionStringIsNull()
        {
            var ex = ExceptionAssertHelper.Throws<ArgumentNullException>(() =>
            {
                using (var listener = new ObservableEventListener())
                {
                    listener.LogToWindowsAzureTable("mytestinstance", null);
                }
            });

            StringAssert.Contains(ex.Message, "Value cannot be null");
            StringAssert.Contains(ex.Message, "Parameter name: connectionString");
        }
开发者ID:husains,项目名称:semantic-logging,代码行数:13,代码来源:WindowsAzureTableSinkFixture.cs

示例11: WhenConnectionStringIsEmpty

        public void WhenConnectionStringIsEmpty()
        {
            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>
            {
                using (var listener = new ObservableEventListener())
                {
                    listener.LogToWindowsAzureTable("mytestinstance", string.Empty);
                }
            });

            StringAssert.Contains(ex.Message, "Argument is empty");
            StringAssert.Contains(ex.Message, "Parameter name: connectionString");
        }
开发者ID:husains,项目名称:semantic-logging,代码行数:13,代码来源:WindowsAzureTableSinkFixture.cs

示例12: WhenTableNameIsInvalid

        public void WhenTableNameIsInvalid()
        {
            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>
            {
                this.tableName = "$$$$";
                var connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageConnectionString"];

                using (var listener = new ObservableEventListener())
                {
                    listener.LogToWindowsAzureTable("mytestinstance", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));
                }
            });

            StringAssert.Contains(ex.Message, "Table names may contain only alphanumeric characters, cannot begin with a numeric character and must be from 3 to 63 characters long.");
            StringAssert.Contains(ex.Message, "Parameter name: tableAddress");
        }
开发者ID:husains,项目名称:semantic-logging,代码行数:16,代码来源:WindowsAzureTableSinkFixture.cs

示例13: WhenTableNameIsEmpty

        public void WhenTableNameIsEmpty()
        {
            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>
            {
                this.tableName = string.Empty;
                var connectionString = System.Configuration.ConfigurationManager.AppSettings["StorageConnectionString"];

                using (var listener = new ObservableEventListener())
                {
                    listener.LogToWindowsAzureTable("mytestinstance", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));
                }
            });

            StringAssert.Contains(ex.Message, "Argument is empty");
            StringAssert.Contains(ex.Message, "Parameter name: tableAddress");
        }
开发者ID:husains,项目名称:semantic-logging,代码行数:16,代码来源:WindowsAzureTableSinkFixture.cs


注:本文中的ObservableEventListener.LogToWindowsAzureTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。