Esempio n. 1
0
        public CosmosDatabaseWrapper(
            DatabaseDependencies dependencies,
            CosmosClientWrapper cosmosClient,
            ILoggingOptions loggingOptions)
            : base(dependencies)
        {
            _cosmosClient = cosmosClient;

            if (loggingOptions.IsSensitiveDataLoggingEnabled)
            {
                _sensitiveLoggingEnabled = true;
            }
        }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public RelationalConnectionDiagnosticsLogger(
     ILoggerFactory loggerFactory,
     ILoggingOptions loggingOptions,
     DiagnosticSource diagnosticSource,
     LoggingDefinitions loggingDefinitions,
     IDbContextLogger contextLogger,
     IDbContextOptions contextOptions,
     IInterceptors?interceptors = null)
     : base(loggerFactory, loggingOptions, diagnosticSource, loggingDefinitions, contextLogger, interceptors)
 {
     _loggingConfigCacheTime = contextOptions.FindExtension <CoreOptionsExtension>()?.LoggingConfigCacheTime ??
                               CoreOptionsExtension.DefaultLoggingConfigCacheTime;
 }
Esempio n. 3
0
 public ThrowingMonsterStateManager(
     IInternalEntityEntryFactory factory,
     IInternalEntityEntrySubscriber subscriber,
     IInternalEntityEntryNotifier notifier,
     IValueGenerationManager valueGeneration,
     IModel model,
     IDatabase database,
     IConcurrencyDetector concurrencyDetector,
     ICurrentDbContext currentContext,
     ILoggingOptions loggingOptions,
     IDiagnosticsLogger <DbLoggerCategory.Update> updateLogger)
     : base(factory, subscriber, notifier, valueGeneration, model, database, concurrencyDetector, currentContext, loggingOptions, updateLogger)
 {
 }
        internal AutofacServiceCollection(ContainerBuilder services, IConfigurationRoot root)
        {
            _configurationBuilder = root is null
                ? new LoggingConfigurationBuilder()
                : new DisabledConfigurationBuilder(root);
            _configurationBuilderLockedStatus = root != null;
            _services     = new AutofacProxyRegister(services);
            _settings     = new LoggingOptions();
            _sinkSettings = new Dictionary <string, ILoggingSinkOptions>();
            _additionalEnricherProviders = new List <Func <ILogEventEnricher> >();

            BeGivenConfigurationBuilder = _configurationBuilder.InitializedByGivenBuilder;
            BeGivenConfigurationRoot    = root != null;
        }
Esempio n. 5
0
        internal StandardLogServiceCollection(IServiceCollection services, IConfigurationRoot root)
        {
            _configurationBuilder = root is null
                ? new LoggingConfigurationBuilder()
                : new DisabledConfigurationBuilder(root);
            _configurationBuilderLockedStatus = root != null;
            _services     = new MicrosoftProxyRegister(services ?? throw new ArgumentNullException(nameof(services)));
            _settings     = new LoggingOptions();
            _sinkSettings = new Dictionary <string, ILoggingSinkOptions>();
            _additionalEnricherProviders = new List <Func <ILogEventEnricher> >();

            BeGivenConfigurationBuilder = _configurationBuilder.InitializedByGivenBuilder;
            BeGivenConfigurationRoot    = root != null;
        }
Esempio n. 6
0
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="loggingOptions"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public StateManagerDependencies With([NotNull] ILoggingOptions loggingOptions)
 => new StateManagerDependencies(
     InternalEntityEntryFactory,
     InternalEntityEntrySubscriber,
     InternalEntityEntryNotifier,
     ValueGenerationManager,
     Model,
     Database,
     ConcurrencyDetector,
     CurrentContext,
     EntityFinderSource,
     SetSource,
     EntityMaterializerSource,
     loggingOptions,
     UpdateLogger);
Esempio n. 7
0
        private static void RegisterLogger(IServiceCollection serviceCollection,
                                           ILoggingOptions loggingOptions, IConfiguration configuration)
        {
            const string applicationInsightsEnvironmentVariable = "APPINSIGHTS_INSTRUMENTATIONKEY";
            var          appInsightsInstrumentationKey          = configuration[applicationInsightsEnvironmentVariable];

            GlobalLoggerConfiguration.ConfigureLogger(loggingOptions, appInsightsInstrumentationKey);
            serviceCollection.AddSingleton(x => Log.Logger); // must be func, as the static logger is configured (changed reference) after DI registering
            serviceCollection.AddSingleton <ILoggerAdapter, SerilogLoggerAdapter>();

            if (!string.IsNullOrEmpty(appInsightsInstrumentationKey))
            {
                serviceCollection.AddApplicationInsightsTelemetry();
            }
        }
Esempio n. 8
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public DiagnosticsLogger(
     [NotNull] ILoggerFactory loggerFactory,
     [NotNull] ILoggingOptions loggingOptions,
     [NotNull] DiagnosticSource diagnosticSource,
     [NotNull] LoggingDefinitions loggingDefinitions,
     [NotNull] IDbContextLogger contextLogger,
     [CanBeNull] IInterceptors interceptors = null)
 {
     DiagnosticSource = diagnosticSource;
     Definitions      = loggingDefinitions;
     DbContextLogger  = contextLogger;
     Logger           = loggerFactory.CreateLogger(new TLoggerCategory());
     Options          = loggingOptions;
     Interceptors     = interceptors;
 }
Esempio n. 9
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public DiagnosticsLogger(
     ILoggerFactory loggerFactory,
     ILoggingOptions loggingOptions,
     DiagnosticSource diagnosticSource,
     LoggingDefinitions loggingDefinitions,
     IDbContextLogger contextLogger,
     IInterceptors?interceptors = null)
 {
     DiagnosticSource = diagnosticSource;
     Definitions      = loggingDefinitions;
     DbContextLogger  = contextLogger;
     Logger           = loggerFactory.CreateLogger(new TLoggerCategory());
     Options          = loggingOptions;
     Interceptors     = interceptors;
 }
Esempio n. 10
0
 /// <summary>
 ///     <para>
 ///         Creates the service dependencies parameter object for a <see cref="CommandBatchPreparer" />.
 ///     </para>
 ///     <para>
 ///         This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///         directly from your code. This API may change or be removed in future releases.
 ///     </para>
 ///     <para>
 ///         Do not call this constructor directly from either provider or application code as it may change
 ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
 ///         will be created and injected automatically by the dependency injection container. To create
 ///         an instance with some dependent services replaced, first resolve the object from the dependency
 ///         injection container, then replace selected services using the 'With...' methods. Do not call
 ///         the constructor at any point in this process.
 ///     </para>
 /// </summary>
 public CommandBatchPreparerDependencies(
     [NotNull] IModificationCommandBatchFactory modificationCommandBatchFactory,
     [NotNull] IParameterNameGeneratorFactory parameterNameGeneratorFactory,
     [NotNull] IComparer <ModificationCommand> modificationCommandComparer,
     [NotNull] IKeyValueIndexFactorySource keyValueIndexFactorySource,
     [NotNull] Func <IStateManager> stateManager,
     [NotNull] ILoggingOptions loggingOptions)
 {
     ModificationCommandBatchFactory = modificationCommandBatchFactory;
     ParameterNameGeneratorFactory   = parameterNameGeneratorFactory;
     ModificationCommandComparer     = modificationCommandComparer;
     KeyValueIndexFactorySource      = keyValueIndexFactorySource;
     StateManager   = stateManager;
     LoggingOptions = loggingOptions;
 }
Esempio n. 11
0
    /// <summary>
    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
    ///     any release. You should only use it directly in your code with extreme caution and knowing that
    ///     doing so can result in application failures when updating to a new Entity Framework Core release.
    /// </summary>
    public RelationalCommandDiagnosticsLogger(
        ILoggerFactory loggerFactory,
        ILoggingOptions loggingOptions,
        DiagnosticSource diagnosticSource,
        LoggingDefinitions loggingDefinitions,
        IDbContextLogger contextLogger,
        IDbContextOptions contextOptions,
        IInterceptors?interceptors = null)
        : base(loggerFactory, loggingOptions, diagnosticSource, loggingDefinitions, contextLogger, interceptors)
    {
        var coreOptionsExtension =
            contextOptions.FindExtension <CoreOptionsExtension>()
            ?? new CoreOptionsExtension();

        _loggingCacheTime = coreOptionsExtension.LoggingCacheTime;
    }
Esempio n. 12
0
 /// <summary>
 ///     <para>
 ///         Creates the service dependencies parameter object for a <see cref="CommandBatchPreparer" />.
 ///     </para>
 ///     <para>
 ///         This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///         the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///         any release. You should only use it directly in your code with extreme caution and knowing that
 ///         doing so can result in application failures when updating to a new Entity Framework Core release.
 ///     </para>
 ///     <para>
 ///         Do not call this constructor directly from either provider or application code as it may change
 ///         as new dependencies are added. Instead, use this type in your constructor so that an instance
 ///         will be created and injected automatically by the dependency injection container. To create
 ///         an instance with some dependent services replaced, first resolve the object from the dependency
 ///         injection container, then replace selected services using the 'With...' methods. Do not call
 ///         the constructor at any point in this process.
 ///     </para>
 /// </summary>
 public CommandBatchPreparerDependencies(
     [NotNull] IModificationCommandBatchFactory modificationCommandBatchFactory,
     [NotNull] IParameterNameGeneratorFactory parameterNameGeneratorFactory,
     [NotNull] IComparer <ModificationCommand> modificationCommandComparer,
     [NotNull] IKeyValueIndexFactorySource keyValueIndexFactorySource,
     [NotNull] ILoggingOptions loggingOptions,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Update> updateLogger,
     [NotNull] IDbContextOptions options)
 {
     ModificationCommandBatchFactory = modificationCommandBatchFactory;
     ParameterNameGeneratorFactory   = parameterNameGeneratorFactory;
     ModificationCommandComparer     = modificationCommandComparer;
     KeyValueIndexFactorySource      = keyValueIndexFactorySource;
     LoggingOptions = loggingOptions;
     UpdateLogger   = updateLogger;
     Options        = options;
 }
Esempio n. 13
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public CommandBatchPreparer(
            [NotNull] IModificationCommandBatchFactory modificationCommandBatchFactory,
            [NotNull] IParameterNameGeneratorFactory parameterNameGeneratorFactory,
            [NotNull] IComparer <ModificationCommand> modificationCommandComparer,
            [NotNull] IKeyValueIndexFactorySource keyValueIndexFactorySource,
            [NotNull] ICurrentDbContext currentContext,
            [NotNull] ILoggingOptions loggingOptions)
        {
            _modificationCommandBatchFactory = modificationCommandBatchFactory;
            _parameterNameGeneratorFactory   = parameterNameGeneratorFactory;
            _modificationCommandComparer     = modificationCommandComparer;
            _keyValueIndexFactorySource      = keyValueIndexFactorySource;
            _currentContext = currentContext;

            if (loggingOptions.IsSensitiveDataLoggingEnabled)
            {
                _sensitiveLoggingEnabled = true;
            }
        }
        /// <summary>
        ///     Creates an event definition instance.
        /// </summary>
        /// <param name="loggingOptions"> Logging options. </param>
        /// <param name="eventId"> The <see cref="Microsoft.Extensions.Logging.EventId" />. </param>
        /// <param name="level"> The <see cref="LogLevel" /> at which the event will be logged. </param>
        /// <param name="eventIdCode"> A string representing the code that should be passed to <see cref="DbContextOptionsBuilder.ConfigureWarnings"/>. </param>
        protected EventDefinitionBase(
            [NotNull] ILoggingOptions loggingOptions,
            EventId eventId,
            LogLevel level,
            [NotNull] string eventIdCode)
        {
            Check.NotNull(loggingOptions, nameof(loggingOptions));
            Check.NotEmpty(eventIdCode, nameof(eventIdCode));

            EventId     = eventId;
            EventIdCode = eventIdCode;

            var warningsConfiguration = loggingOptions.WarningsConfiguration;

            if (warningsConfiguration != null)
            {
                var levelOverride = warningsConfiguration.GetLevel(eventId);
                if (levelOverride.HasValue)
                {
                    level = levelOverride.Value;
                }

                var behavior = warningsConfiguration.GetBehavior(eventId);
                if (behavior.HasValue)
                {
                    _warningBehavior = behavior.Value;
                }
                else
                {
                    _warningBehavior = level == LogLevel.Warning &&
                                       warningsConfiguration.DefaultBehavior == WarningBehavior.Throw
                        ? WarningBehavior.Throw
                        : WarningBehavior.Log;
                }
            }
            else
            {
                _warningBehavior = WarningBehavior.Log;
            }

            Level = level;
        }
Esempio n. 15
0
        public static void ConfigureLogger(ILoggingOptions loggingOptions, string appInsightsInstrumentationKey)
        {
            var loggerConfiguration = new LoggerConfiguration()
                                      .MinimumLevel.Debug()
                                      .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
                                      .Enrich.FromLogContext()
                                      .WriteTo.Console(outputTemplate: loggingOptions.LogMessageTemplate)
                                      .WriteTo.Logger(l => l
                                                      .WriteTo.File(
                                                          Path.Combine(loggingOptions.LogsLocation, loggingOptions.LogFile),
                                                          rollingInterval: RollingInterval.Day,
                                                          outputTemplate: loggingOptions.LogMessageTemplate));

            if (!string.IsNullOrEmpty(appInsightsInstrumentationKey))
            {
                loggerConfiguration.WriteTo.ApplicationInsights(appInsightsInstrumentationKey, TelemetryConverter.Traces);
            }

            Log.Logger = loggerConfiguration.CreateLogger();
        }
Esempio n. 16
0
        public FileContextStoreCache(
            [NotNull] ILoggingOptions loggingOptions,
            [CanBeNull] IFileContextSingletonOptions options)
        {
            _loggingOptions = loggingOptions;
            if (options?.DatabaseRoot != null)
            {
                _useNameMatching = true;

                LazyInitializer.EnsureInitialized(
                    ref options.DatabaseRoot.Instance,
                    () => new ConcurrentDictionary <IFileContextScopedOptions, IFileContextStore>());

                _namedStores = (ConcurrentDictionary <IFileContextScopedOptions, IFileContextStore>)options.DatabaseRoot.Instance;
            }
            else
            {
                _namedStores = new ConcurrentDictionary <IFileContextScopedOptions, IFileContextStore>();
            }
        }
Esempio n. 17
0
 public ChangeDetectorProxy(
     IDiagnosticsLogger <DbLoggerCategory.ChangeTracking> logger,
     ILoggingOptions loggingOptions)
     : base(logger, loggingOptions)
 {
 }
 public MicaLogManager(ILoggingOptions loggingOptions)
 {
     this._loggingOptions = loggingOptions;
 }
Esempio n. 19
0
 public IndexingInMemoryTableFactory(ILoggingOptions loggingOptions) : base(loggingOptions)
 {
 }
Esempio n. 20
0
 /// <summary>
 /// Initialize <see cref="Log"/>
 /// </summary>
 /// <param name="outputPane">The Visual Studio output window pane</param>
 /// <param name="loggingOptions">The logging options</param>
 public void InitializeLog(IVsOutputWindowPane outputPane, ILoggingOptions loggingOptions)
 {
     _outputPane     = outputPane;
     _loggingOptions = loggingOptions;
 }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public InMemoryTableFactory([NotNull] ILoggingOptions loggingOptions)
        {
            Check.NotNull(loggingOptions, nameof(loggingOptions));

            _sensitiveLoggingEnabled = loggingOptions.IsSensitiveDataLoggingEnabled;
        }
Esempio n. 22
0
 public EventDefinitionBaseStub(ILoggingOptions loggingOptions, EventId eventId, LogLevel level, string eventIdCode) : base(loggingOptions, eventId, level, eventIdCode)
 {
 }
Esempio n. 23
0
 public SerializableTableFactory(ILoggingOptions loggingOptions, LocalStorageOptions localStorageOptions, ISyncLocalStorageService localStorage)
 {
     _sensitiveLoggingEnabled = loggingOptions.IsSensitiveDataLoggingEnabled;
     _localStorageOptions     = localStorageOptions;
     _localStorage            = localStorage;
 }
Esempio n. 24
0
 protected void ActiveCorePreferencesRenders(LoggingConfigurationBuilder builder, ILoggingOptions settings)
 {
     if (settings is LoggingOptions options)
     {
         if (options.AutomaticalScanRendererEnabled)
         {
             PreferencesRenderersScanner.Scan();
         }
         else
         {
             PreferencesRenderersScanner.Given(options.ManuallyRendererTypes);
         }
     }
     else
     {
         PreferencesRenderersScanner.Scan();
     }
 }
Esempio n. 25
0
 protected void ActiveMessageTemplatePreheater(LoggingConfigurationBuilder builder, ILoggingOptions settings)
 {
     MessageTemplateCachePreheaterAction?.Invoke(_messageTemplateCachePreheater);
 }