Exemplo n.º 1
0
        protected override void SendBuffer(LoggingEvent[] events)
        {
            var grouped = events.GroupBy(evt => evt.LoggerName);

            foreach (var group in grouped)
            {
                foreach (var batch in group.Batch(100))
                {
                    var batchOperation = new TableBatchOperation();
                    foreach (var azureLoggingEvent in batch.Select(GetLogEntity))
                    {
                        batchOperation.Insert(azureLoggingEvent);
                    }
                    _table.ExecuteBatch(batchOperation);
                }
            }
        }
        protected override void SendBuffer(LoggingEvent[] events)
        {
            

            //Batched ops require single partition key, group
            //by loggername to obey requirment.
            var grouped = events.GroupBy(evt => evt.LoggerName);

            foreach (var group in grouped)
            {
                var batchOperation = new TableBatchOperation();
                foreach (var azureLoggingEvent in group.Select(@event => new AzureLoggingEventEntity(@event)))
                {
                    batchOperation.Insert(azureLoggingEvent);
                }
                _table.ExecuteBatch(batchOperation);
            }
            
            
        }