public ThreadSafeTransferStatisticsBase(IErrorDetailsProvider errorDetailsProvider)
        {
            Guard.NotNull("errorDetailsProvider", errorDetailsProvider);

            this.errorDetailsProvider = errorDetailsProvider;
            timer = new Stopwatch();
        }
示例#2
0
        public ThreadSafeTransferStatisticsBase(IErrorDetailsProvider errorDetailsProvider)
        {
            Guard.NotNull("errorDetailsProvider", errorDetailsProvider);

            this.errorDetailsProvider = errorDetailsProvider;
            timer = new Stopwatch();
        }
示例#3
0
        public CosmosDBErrorLogTransferStatistics(IErrorDetailsProvider errorDetailsProvider, IReadOnlyDictionary <string, string> destConfiguration,
                                                  string userProvidedLogDestination, CancellationToken cancellation) : base(errorDetailsProvider)
        {
            string destConnectionString;

            if (!string.IsNullOrEmpty(userProvidedLogDestination))
            {
                destConnectionString = userProvidedLogDestination;
            }
            if (destConfiguration.TryGetValue("ConnectionString", out destConnectionString) && destConnectionString.Contains(".table.cosmos"))
            {
                CloudStorageAccount   storageAccount   = CloudStorageAccount.Parse(destConnectionString);
                TableConnectionPolicy connectionPolicy = new TableConnectionPolicy()
                {
                    UseDirectMode  = true,
                    UseTcpProtocol = true,
                };
                remoteLogger = remoteLoggingClientProvider.CreateRemoteLoggingClient(storageAccount, connectionPolicy);
                remoteLogger.CreateRemoteLoggingTableIfNotExists(cancellation);
            }
            else
            {
                throw new Exception("Cosmos Table remote logging not possible. Destination needs to be a Cosmos Tables endpoint or" +
                                    "provide connection string with the" +
                                    "CosmosTableLogConnectionString flag to log.");
            }
        }
        public CsvErrorLogTransferStatistics(StreamWriter errorLogStreamWriter, IErrorDetailsProvider errorDetailsProvider)
            : base(errorDetailsProvider)
        {
            Guard.NotNull("errorLogStream", errorLogStreamWriter);

            this.errorLogStreamWriter = errorLogStreamWriter;
            errorLogSynchronizedWriter = TextWriter.Synchronized(errorLogStreamWriter);
        }
示例#5
0
        public CsvErrorLogTransferStatistics(StreamWriter errorLogStreamWriter, IErrorDetailsProvider errorDetailsProvider)
            : base(errorDetailsProvider)
        {
            Guard.NotNull("errorLogStream", errorLogStreamWriter);

            this.errorLogStreamWriter  = errorLogStreamWriter;
            errorLogSynchronizedWriter = TextWriter.Synchronized(errorLogStreamWriter);
        }
        public async Task <ITransferStatistics> Create(IErrorDetailsProvider errorDetailsProvider, ITransferStatisticsConfiguration configuration,
                                                       CancellationToken cancellation)
        {
            var defaultStatistics = await defaultFactory.Create(errorDetailsProvider, configuration, cancellation);

            return(String.IsNullOrEmpty(configuration.ErrorLog)
                ? new ObservableErrorsTransferStatistics(defaultStatistics, errorDetailsProvider, SynchronizationContext.Current)
                : defaultStatistics);
        }
        public async Task <ITransferStatistics> Create(IErrorDetailsProvider errorDetailsProvider, ITransferStatisticsConfiguration configuration,
                                                       CancellationToken cancellation)
        {
            Guard.NotNull("configuration", configuration);

            return(String.IsNullOrEmpty(configuration.ErrorLog)
                ? (ITransferStatistics) new InMemoryTransferStatistics(errorDetailsProvider)
                : new CsvErrorLogTransferStatistics(
                       await SinkStreamProvidersFactory.Create(
                           configuration.ErrorLog, configuration.OverwriteErrorLog).CreateWriter(cancellation),
                       errorDetailsProvider));
        }
        public async Task<ITransferStatistics> Create(IErrorDetailsProvider errorDetailsProvider, ITransferStatisticsConfiguration configuration,
            CancellationToken cancellation)
        {
            Guard.NotNull("configuration", configuration);

            return String.IsNullOrEmpty(configuration.ErrorLog)
                ? (ITransferStatistics)new InMemoryTransferStatistics(errorDetailsProvider)
                : new CsvErrorLogTransferStatistics(
                    await SinkStreamProvidersFactory.Create(
                        configuration.ErrorLog, configuration.OverwriteErrorLog).CreateWriter(cancellation),
                    errorDetailsProvider);
        }
        public ObservableErrorsTransferStatistics(ITransferStatistics defaultStatistics, IErrorDetailsProvider errorDetailsProvider,
                                                  SynchronizationContext observableSynchronizationContext)
        {
            Guard.NotNull("defaultStatistics", defaultStatistics);
            Guard.NotNull("errorDetailsProvider", errorDetailsProvider);
            Guard.NotNull("observableSynchronizationContext", observableSynchronizationContext);

            this.defaultStatistics                = defaultStatistics;
            this.errorDetailsProvider             = errorDetailsProvider;
            this.observableSynchronizationContext = observableSynchronizationContext;

            errors = new ObservableCollection <KeyValuePair <string, string> >();
        }
        public ObservableErrorsTransferStatistics(ITransferStatistics defaultStatistics, IErrorDetailsProvider errorDetailsProvider,
            SynchronizationContext observableSynchronizationContext)
        {
            Guard.NotNull("defaultStatistics", defaultStatistics);
            Guard.NotNull("errorDetailsProvider", errorDetailsProvider);
            Guard.NotNull("observableSynchronizationContext", observableSynchronizationContext);

            this.defaultStatistics = defaultStatistics;
            this.errorDetailsProvider = errorDetailsProvider;
            this.observableSynchronizationContext = observableSynchronizationContext;

            errors = new ObservableCollection<KeyValuePair<string, string>>();
        }
        public async Task <ITransferStatistics> Create(IErrorDetailsProvider errorDetailsProvider, ITransferStatisticsConfiguration configuration,
                                                       IReadOnlyDictionary <string, string> destConfiguration, CancellationToken cancellation)
        {
            Guard.NotNull("configuration", configuration);
            Guard.NotNull("destConfiguration", destConfiguration);

            if (configuration.EnableCosmosTableLog)
            {
                return(new CosmosDBErrorLogTransferStatistics(errorDetailsProvider, destConfiguration, configuration.CosmosTableLogConnectionString, cancellation));
            }

            return(String.IsNullOrEmpty(configuration.ErrorLog)
                ? (ITransferStatistics) new InMemoryTransferStatistics(errorDetailsProvider)
                : new CsvErrorLogTransferStatistics(
                       new StreamWriter(
                           await SinkStreamProvidersFactory.Create(configuration.ErrorLog, false, configuration.OverwriteErrorLog)
                           .CreateStream(cancellation)),
                       errorDetailsProvider));
        }
 public ErrorHandler(IHelpHandler helpHandler, IErrorDetailsProvider errorDetailsProvider)
 {
     this.helpHandler = helpHandler;
     this.errorDetailsProvider = errorDetailsProvider;
 }
示例#13
0
 public ErrorHandler(IHelpHandler helpHandler, IErrorDetailsProvider errorDetailsProvider)
 {
     this.helpHandler          = helpHandler;
     this.errorDetailsProvider = errorDetailsProvider;
 }
 public TransferStatisticsHandler(ITransferStatisticsFactory statisticsFactory, IErrorDetailsProvider errorDetailsProvider)
 {
     this.statisticsFactory = statisticsFactory;
     this.errorDetailsProvider = errorDetailsProvider;
 }
 public Task <ITransferStatistics> Create(IErrorDetailsProvider errorDetailsProvider, ITransferStatisticsConfiguration configuration, IReadOnlyDictionary <string, string> destConfiguration, CancellationToken cancellation)
 {
     throw new NotImplementedException();
 }
示例#16
0
 public InMemoryTransferStatistics(IErrorDetailsProvider errorDetailsProvider)
     : base(errorDetailsProvider)
 {
     errors = new AppendOnlyConcurrentLinkedList <KeyValuePair <string, string> >();
 }
 public TransferStatisticsHandler(ITransferStatisticsFactory statisticsFactory, IErrorDetailsProvider errorDetailsProvider)
 {
     this.statisticsFactory    = statisticsFactory;
     this.errorDetailsProvider = errorDetailsProvider;
 }
 public InMemoryTransferStatistics(IErrorDetailsProvider errorDetailsProvider)
     : base(errorDetailsProvider)
 {
     errors = new AppendOnlyConcurrentLinkedList<KeyValuePair<string, string>>();
 }