/// <summary> /// Construct a sink that saves logs to the specified storage account. /// </summary> /// <param name="storageAccount">The Cloud Storage Account to use to insert the log entries to.</param> /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param> /// <param name="storageTableName">Table name that log entries will be written to. Note: Optional, setting this may impact performance</param> /// <param name="additionalRowKeyPostfix">Additional postfix string that will be appended to row keys</param> public AzureTableStorageWithPropertiesSink(CloudStorageAccount storageAccount, IFormatProvider formatProvider, string storageTableName = null, string additionalRowKeyPostfix = null) { var tableClient = storageAccount.CreateCloudTableClient(); if (string.IsNullOrEmpty(storageTableName)) { storageTableName = "LogEventEntity"; } _table = tableClient.GetTableReference(storageTableName); _table.CreateIfNotExists(); _formatProvider = formatProvider; if (additionalRowKeyPostfix != null) { _additionalRowKeyPostfix = AzureTableStorageEntityFactory.GetValidStringForTableKey(additionalRowKeyPostfix); } }
/// <summary> /// Construct a sink that saves logs to the specified storage account. /// </summary> /// <param name="storageAccount">The Cloud Storage Account to use to insert the log entries to.</param> /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param> /// <param name="batchSizeLimit"></param> /// <param name="period"></param> /// <param name="storageTableName">Table name that log entries will be written to. Note: Optional, setting this may impact performance</param> /// <param name="additionalRowKeyPostfix">Additional postfix string that will be appended to row keys</param> public AzureBatchingTableStorageWithPropertiesSink(CloudStorageAccount storageAccount, IFormatProvider formatProvider, int batchSizeLimit, TimeSpan period, string storageTableName = null, string additionalRowKeyPostfix = null) : base(batchSizeLimit, period) { var tableClient = storageAccount.CreateCloudTableClient(); if (string.IsNullOrEmpty(storageTableName)) { storageTableName = "LogEventEntity"; } _table = tableClient.GetTableReference(storageTableName); _table.CreateIfNotExistsAsync().SyncContextSafeWait(_waitTimeoutMilliseconds); _formatProvider = formatProvider; if (additionalRowKeyPostfix != null) { _additionalRowKeyPostfix = AzureTableStorageEntityFactory.GetValidStringForTableKey(additionalRowKeyPostfix); } }