/// <summary>
        /// Initializes a new instance of the <see cref="StorageClientProvider{TClient, TClientOptions}"/> class that uses the registered Azure services.
        /// </summary>
        /// <param name="componentFactory">The Azure factory responsible for creating clients. <see cref="AzureComponentFactory"/>.</param>
        /// <param name="logForwarder">Log forwarder that forwards events to ILogger. <see cref="AzureEventSourceLogForwarder"/>.</param>
        public StorageClientProvider(AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder)
        {
            _componentFactory = componentFactory;
            _logForwarder     = logForwarder;

            _logForwarder.Start();
        }
Esempio n. 2
0
 public QueueServiceClientProvider(
     IConfiguration configuration,
     AzureComponentFactory componentFactory,
     AzureEventSourceLogForwarder logForwarder,
     IOptions <QueuesOptions> queueOptions)
     : base(configuration, componentFactory, logForwarder)
 {
     _queuesOptions = queueOptions?.Value;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="StorageClientProvider{TClient, TClientOptions}"/> class that uses the registered Azure services.
        /// </summary>
        /// <param name="configuration">The configuration to use when creating Client-specific objects. <see cref="IConfiguration"/></param>
        /// <param name="componentFactory">The Azure factory responsible for creating clients. <see cref="AzureComponentFactory"/></param>
        /// <param name="logForwarder">Log forwarder that forwards events to ILogger. <see cref="AzureEventSourceLogForwarder"/></param>
        /// <param name="logger">Logger used when there is an error creating a client</param>
        public StorageClientProvider(IConfiguration configuration, AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder, ILogger <TClient> logger)
        {
            _configuration    = configuration;
            _componentFactory = componentFactory;
            _logForwarder     = logForwarder;
            _logger           = logger;

            _logForwarder?.Start();
        }
Esempio n. 4
0
 public ServiceBusClientFactory(
     IConfiguration configuration,
     AzureComponentFactory componentFactory,
     MessagingProvider messagingProvider,
     AzureEventSourceLogForwarder logForwarder)
 {
     _configuration     = configuration;
     _componentFactory  = componentFactory;
     _messagingProvider = messagingProvider;
     logForwarder.Start();
 }
 public ServiceBusClientFactory(
     IConfiguration configuration,
     AzureComponentFactory componentFactory,
     MessagingProvider messagingProvider,
     AzureEventSourceLogForwarder logForwarder,
     IOptions <ServiceBusOptions> options)
 {
     _configuration     = configuration;
     _componentFactory  = componentFactory;
     _messagingProvider = messagingProvider;
     _options           = options?.Value ?? throw new ArgumentNullException(nameof(options));
     logForwarder.Start();
 }
Esempio n. 6
0
        internal static EventHubClientFactory CreateFactory(IConfiguration configuration, EventHubOptions options, AzureComponentFactory componentFactory = null)
        {
            componentFactory ??= Mock.Of <AzureComponentFactory>();
            var loggerFactory = new NullLoggerFactory();
            var azureEventSourceLogForwarder = new AzureEventSourceLogForwarder(loggerFactory);

            return(new EventHubClientFactory(
                       configuration,
                       componentFactory,
                       Options.Create(options),
                       new DefaultNameResolver(configuration),
                       azureEventSourceLogForwarder,
                       new CheckpointClientProvider(configuration, componentFactory, azureEventSourceLogForwarder, loggerFactory.CreateLogger <BlobServiceClient>())));
        }
        public void MapsLevelsCorrectly(EventLevel eventLevel, LogLevel logLevel)
        {
            var loggerFactory = new MockLoggerFactory();

            using (var forwarder = new AzureEventSourceLogForwarder(loggerFactory))
            {
                forwarder.Start();
                typeof(TestSource).GetMethod(eventLevel.ToString(), BindingFlags.Instance | BindingFlags.Public).Invoke(TestSource.Log, Array.Empty <object>());
            }

            var logs = loggerFactory.Loggers["Test.source"].Logs;

            Assert.AreEqual(1, logs.Count);
            Assert.AreEqual(logLevel, logs[0].Level);
        }
 public QueueServiceClientProvider(
     IConfiguration configuration,
     AzureComponentFactory componentFactory,
     AzureEventSourceLogForwarder logForwarder,
     IOptions <QueuesOptions> queueOptions,
     ILoggerFactory loggerFactory,
     IQueueProcessorFactory queueProcessorFactory,
     SharedQueueWatcher messageEnqueuedWatcher)
     : base(configuration, componentFactory, logForwarder)
 {
     _queuesOptions          = queueOptions?.Value;
     _loggerFactory          = loggerFactory;
     _queueProcessorFactory  = queueProcessorFactory;
     _messageEnqueuedWatcher = messageEnqueuedWatcher;
 }
        public HostAzureBlobStorageProvider(IScriptHostManager scriptHostManager, IConfiguration configuration, IOptionsMonitor <JobHostInternalStorageOptions> options, ILogger <HostAzureBlobStorageProvider> logger, AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _storageOptions = options ?? throw new ArgumentNullException(nameof(options));
            _logger         = logger ?? throw new ArgumentNullException(nameof(logger));

            _blobServiceClientProvider = new BlobServiceClientProvider(componentFactory, logForwarder);

            if (FeatureFlags.IsEnabled(ScriptConstants.FeatureFlagDisableMergedWebHostScriptHostConfiguration))
            {
                Configuration = configuration;
            }
            else
            {
                if (scriptHostManager == null)
                {
                    throw new ArgumentNullException(nameof(scriptHostManager));
                }

                Configuration = new ConfigurationBuilder()
                                .Add(new ActiveHostConfigurationSource(scriptHostManager))
                                .AddConfiguration(configuration)
                                .Build();
            }
        }
Esempio n. 10
0
 public QueueServiceClientProvider(IConfiguration configuration, AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder)
     : base(configuration, componentFactory, logForwarder)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BlobServiceClientProvider"/> class that uses the registered Azure services to create a BlobServiceClient.
 /// </summary>
 /// <param name="componentFactory">The Azure factory responsible for creating clients. <see cref="AzureComponentFactory"/></param>
 /// <param name="logForwarder">Log forwarder that forwards events to ILogger. <see cref="AzureEventSourceLogForwarder"/></param>
 public BlobServiceClientProvider(AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder)
     : base(componentFactory, logForwarder)
 {
 }
 public BlobServiceClientProvider(IConfiguration configuration, AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder, ILogger <BlobServiceClient> logger)
     : base(configuration, componentFactory, logForwarder, logger)
 {
 }
        public void CanDisposeNonStarted()
        {
            var forwarder = new AzureEventSourceLogForwarder(null);

            forwarder.Dispose();
        }
 public void WorksWithNullLoggerFactory()
 {
     using var forwarder = new AzureEventSourceLogForwarder(null);
     forwarder.Start();
     TestSource.Log.Informational();
 }
Esempio n. 15
0
 public InstrumentedTableClientProvider(RecordedTestBase recording, IConfiguration configuration, AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder, ILogger <TableServiceClient> logger) : base(configuration, componentFactory, logForwarder, logger)
 {
     _recording = recording;
 }