public HTMLCSharpLanguageServerFeedbackFileLoggerProvider(
            HTMLCSharpLanguageServerFeedbackFileLoggerProviderFactory loggerFactory)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _loggerProvider = (FeedbackFileLoggerProvider)loggerFactory.GetOrCreate(LogFileIdentifier);
        }
コード例 #2
0
        public void CreateLogger_Category_EnabledByDefault()
        {
            // Arrange
            var fileLogWriter = Mock.Of <FeedbackFileLogWriter>(MockBehavior.Strict);
            var provider      = new FeedbackFileLoggerProvider(fileLogWriter);
            var categoryName  = "Test";

            // Act
            var logger = provider.CreateLogger(categoryName);

            // Assert
            Assert.True(logger.IsEnabled(LogLevel.Trace));
            provider.Dispose();
        }
コード例 #3
0
        public void CreateLogger_OmniSharpFrameworkCategory_DisabledByDefault()
        {
            // Arrange
            var fileLogWriter = Mock.Of <FeedbackFileLogWriter>(MockBehavior.Strict);
            var provider      = new FeedbackFileLoggerProvider(fileLogWriter);
            var categoryName  = FeedbackFileLoggerProvider.OmniSharpFrameworkCategoryPrefix + ".Test";

            // Act
            var logger = provider.CreateLogger(categoryName);

            // Assert
            Assert.False(logger.IsEnabled(LogLevel.Trace));
            provider.Dispose();
        }
コード例 #4
0
        public override object GetOrCreate(string logFileIdentifier)
        {
            lock (_creationLock)
            {
                if (_currentFileLogWriter != null)
                {
                    // Dispose last log writer so we can start a new session. Technically only one should only ever be active at a time.
                    _currentFileLogWriter.Dispose();
                }

                _currentFileLogWriter = new DefaultFeedbackFileLogWriter(_feedbackLogDirectoryProvider, logFileIdentifier);
                var provider = new FeedbackFileLoggerProvider(_currentFileLogWriter);

                return(provider);
            }
        }