当前位置: 首页>>代码示例>>C#>>正文


C# LogAggregator类代码示例

本文整理汇总了C#中LogAggregator的典型用法代码示例。如果您正苦于以下问题:C# LogAggregator类的具体用法?C# LogAggregator怎么用?C# LogAggregator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogAggregator类属于命名空间,在下文中一共展示了LogAggregator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogAnalyzerCrashCountSummary

        public static void LogAnalyzerCrashCountSummary(int correlationId, LogAggregator logAggregator)
        {
            if (logAggregator == null)
            {
                return;
            }

            foreach (var analyzerCrash in logAggregator)
            {
                Logger.Log(FunctionId.DiagnosticAnalyzerDriver_AnalyzerCrash, KeyValueLogMessage.Create(m =>
                {
                    var key = (ValueTuple<bool, Type, Type>)analyzerCrash.Key;
                    bool telemetry = key.Item1;
                    m[Id] = correlationId;

                    // we log analyzer name and exception as it is, if telemetry is allowed
                    if (telemetry)
                    {
                        m[AnalyzerName] = key.Item2.FullName;
                        m[AnalyzerCrashCount] = analyzerCrash.Value.GetCount();
                        m[AnalyzerException] = key.Item3.FullName;
                    }
                    else
                    {
                        string analyzerName = key.Item2.FullName;
                        string exceptionName = key.Item3.FullName;

                        m[AnalyzerHashCode] = ComputeSha256Hash(analyzerName);
                        m[AnalyzerCrashCount] = analyzerCrash.Value.GetCount();
                        m[AnalyzerExceptionHashCode] = ComputeSha256Hash(exceptionName);
                    }
                }));
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:34,代码来源:DiagnosticAnalyzerLogger.cs

示例2: LogAnalyzerCrashCount

        public static void LogAnalyzerCrashCount(DiagnosticAnalyzer analyzer, Exception ex, LogAggregator logAggregator, ProjectId projectId)
        {
            if (logAggregator == null || analyzer == null || ex == null || ex is OperationCanceledException)
            {
                return;
            }

            // TODO: once we create description manager, pass that into here.
            bool telemetry = DiagnosticAnalyzerLogger.AllowsTelemetry(null, analyzer, projectId);
            var tuple = ValueTuple.Create(telemetry, analyzer.GetType(), ex.GetType());
            logAggregator.IncreaseCount(tuple);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:DiagnosticAnalyzerLogger.cs

示例3: WorkCoordinator

            public WorkCoordinator(
                 IAsynchronousOperationListener listener,
                 IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
                 Registration registration)
            {
                _logAggregator = new LogAggregator();

                _registration = registration;

                _listener = listener;
                _optionService = _registration.GetService<IOptionService>();

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);

                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, analyzerProviders, _registration,
                    activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, _registration, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(InternalSolutionCrawlerOptions.SolutionCrawler))
                {
                    _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _registration.Workspace.DocumentOpened += OnDocumentOpened;
                    _registration.Workspace.DocumentClosed += OnDocumentClosed;
                }

                // subscribe to option changed event after all required fields are set
                // otherwise, we can get null exception when running OnOptionChanged handler
                _optionService.OptionChanged += OnOptionChanged;
            }
开发者ID:TyOverby,项目名称:roslyn,代码行数:43,代码来源:WorkCoordinator.cs

示例4: WorkCoordinator

            public WorkCoordinator(
                 IAsynchronousOperationListener listener,
                 IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
                 int correlationId, Workspace workspace)
            {
                _logAggregator = new LogAggregator();

                _listener = listener;
                _optionService = workspace.Services.GetService<IOptionService>();
                _optionService.OptionChanged += OnOptionChanged;

                // set up workspace 
                _correlationId = correlationId;
                _workspace = workspace;

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);
                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, correlationId, workspace, analyzerProviders, activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, correlationId, workspace, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(SolutionCrawlerOptions.SolutionCrawler))
                {
                    _workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _workspace.DocumentOpened += OnDocumentOpened;
                    _workspace.DocumentClosed += OnDocumentClosed;
                }
            }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:40,代码来源:WorkCoordinator.cs

示例5: LogIncrementalAnalyzerProcessorStatistics

        public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, Solution solution, LogAggregator logAggregator, ImmutableArray<IIncrementalAnalyzer> analyzers)
        {
            Logger.Log(FunctionId.IncrementalAnalyzerProcessor_Shutdown, KeyValueLogMessage.Create(m =>
            {
                var solutionHash = GetSolutionHash(solution);

                m[Id] = correlationId;
                m[SolutionHash] = solutionHash.ToString();

                var statMap = new Dictionary<string, List<int>>();
                foreach (var kv in logAggregator)
                {
                    if (kv.Key is string)
                    {
                        m[kv.Key.ToString()] = kv.Value.GetCount();
                        continue;
                    }

                    if (kv.Key is ValueTuple<string, Guid>)
                    {
                        var tuple = (ValueTuple<string, Guid>)kv.Key;
                        var list = statMap.GetOrAdd(tuple.Item1, _ => new List<int>());
                        list.Add(kv.Value.GetCount());
                        continue;
                    }

                    throw ExceptionUtilities.Unreachable;
                }

                foreach (var kv in statMap)
                {
                    var key = kv.Key.ToString();
                    var result = LogAggregator.GetStatistics(kv.Value);

                    m[CreateProperty(key, Max)] = result.Maximum;
                    m[CreateProperty(key, Min)] = result.Minimum;
                    m[CreateProperty(key, Median)] = result.Median;
                    m[CreateProperty(key, Mean)] = result.Mean;
                    m[CreateProperty(key, Mode)] = result.Mode;
                    m[CreateProperty(key, Range)] = result.Range;
                    m[CreateProperty(key, Count)] = result.Count;
                }
            }));

            foreach (var analyzer in analyzers)
            {
                var diagIncrementalAnalyzer = analyzer as BaseDiagnosticIncrementalAnalyzer;
                if (diagIncrementalAnalyzer != null)
                {
                    diagIncrementalAnalyzer.LogAnalyzerCountSummary();
                    break;
                }
            }
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:54,代码来源:SolutionCrawlerLogger.cs

示例6: LogResetStates

 public static void LogResetStates(LogAggregator logAggregator)
 {
     logAggregator.IncreaseCount(ResetStates);
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:4,代码来源:SolutionCrawlerLogger.cs

示例7: LogHigherPriority

 public static void LogHigherPriority(LogAggregator logAggregator, Guid documentId)
 {
     logAggregator.IncreaseCount(HigherPriority);
     logAggregator.IncreaseCount(ValueTuple.Create(HigherPriority, documentId));
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:5,代码来源:SolutionCrawlerLogger.cs

示例8: LogWorkItemEnqueue

        public static void LogWorkItemEnqueue(
            LogAggregator logAggregator, string language, DocumentId documentId, InvocationReasons reasons, bool lowPriority, SyntaxPath activeMember, bool added)
        {
            logAggregator.IncreaseCount(language);
            logAggregator.IncreaseCount(added ? NewWorkItem : UpdateWorkItem);

            if (documentId != null)
            {
                logAggregator.IncreaseCount(activeMember == null ? TopLevel : MemberLevel);

                if (lowPriority)
                {
                    logAggregator.IncreaseCount(LowerPriority);
                    logAggregator.IncreaseCount(ValueTuple.Create(LowerPriority, documentId.Id));
                }
            }

            foreach (var reason in reasons)
            {
                logAggregator.IncreaseCount(reason);
            }
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:22,代码来源:SolutionCrawlerLogger.cs

示例9: DiagnosticAnalyzerDriver

 public DiagnosticAnalyzerDriver(Document document, TextSpan? span, SyntaxNode root, LogAggregator logAggregator, CancellationToken cancellationToken)
     : this(document, span, root, document.Project.LanguageServices.GetService<ISyntaxNodeAnalyzerService>(), cancellationToken)
 {
     _logAggregator = logAggregator;
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:5,代码来源:DiagnosticAnalyzerDriver.cs

示例10: LogProcessProject

        public static void LogProcessProject(LogAggregator logAggregator, Guid projectId, bool processed)
        {
            if (processed)
            {
                logAggregator.IncreaseCount(ProcessProject);
            }
            else
            {
                logAggregator.IncreaseCount(ProcessProjectCancellation);
            }

            logAggregator.IncreaseCount(ValueTuple.Create(ProcessProject, projectId));
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:13,代码来源:SolutionCrawlerLogger.cs

示例11: LogProcessDocument

        public static void LogProcessDocument(LogAggregator logAggregator, Guid documentId, bool processed)
        {
            if (processed)
            {
                logAggregator.IncreaseCount(ProcessDocument);
            }
            else
            {
                logAggregator.IncreaseCount(ProcessDocumentCancellation);
            }

            logAggregator.IncreaseCount(ValueTuple.Create(ProcessDocument, documentId));
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:13,代码来源:SolutionCrawlerLogger.cs

示例12: LogWorkCoordinatorShutdown

        public static void LogWorkCoordinatorShutdown(int correlationId, LogAggregator logAggregator)
        {
            Logger.Log(FunctionId.WorkCoordinator_Shutdown, KeyValueLogMessage.Create(m =>
            {
                m[Id] = correlationId;

                foreach (var kv in logAggregator)
                {
                    var change = ((WorkspaceChangeKind)kv.Key).ToString();
                    m[change] = kv.Value.GetCount();
                }
            }));
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:13,代码来源:SolutionCrawlerLogger.cs

示例13: LogWorkspaceEvent

 public static void LogWorkspaceEvent(LogAggregator logAggregator, int kind)
 {
     logAggregator.IncreaseCount(kind);
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:4,代码来源:SolutionCrawlerLogger.cs

示例14: LogProcessOpenDocument

 public static void LogProcessOpenDocument(LogAggregator logAggregator, Guid documentId)
 {
     logAggregator.IncreaseCount(OpenDocument);
     logAggregator.IncreaseCount(ValueTuple.Create(OpenDocument, documentId));
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:5,代码来源:SolutionCrawlerLogger.cs

示例15: LogProcessActiveFileDocument

 public static void LogProcessActiveFileDocument(LogAggregator logAggregator, Guid documentId, bool processed)
 {
     if (processed)
     {
         logAggregator.IncreaseCount(ActiveFileProcessDocument);
     }
     else
     {
         logAggregator.IncreaseCount(ActiveFileProcessDocumentCancellation);
     }
 }
开发者ID:daking2014,项目名称:roslyn,代码行数:11,代码来源:SolutionCrawlerLogger.cs


注:本文中的LogAggregator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。