Beispiel #1
0
 /// <summary>
 /// log a start and end pair with a context message.
 /// </summary>
 public static IDisposable LogBlock(FunctionId functionId, LogMessage logMessage, CancellationToken token)
 => TryGetActiveLogger(functionId, out _) ?
 CreateLogBlock(functionId, logMessage, GetNextUniqueBlockId(), token) :
 EmptyLogBlock.Instance;
 public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
 {
     OutputPane.WriteLine(string.Format("[{0}] Start({1}) : {2} - {3}", Thread.CurrentThread.ManagedThreadId, uniquePairId, functionId.ToString(), logMessage.GetMessage()));
 }
Beispiel #3
0
 public static Option <bool> GetOption(FunctionId id)
 {
     return(s_options.GetOrAdd(id, s_optionCreator));
 }
Beispiel #4
0
 public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
 {
 }
 public bool IsEnabled(FunctionId functionId)
 {
     return(_loggingChecker == null || _loggingChecker(functionId));
 }
Beispiel #6
0
 public void BlockCanceled(FunctionId functionId, int tick, int blockId)
 {
     WriteEvent(5, (int)functionId, tick, blockId);
 }
Beispiel #7
0
 public void Log(FunctionId functionId, LogMessage logMessage)
 {
 }
Beispiel #8
0
 /// <summary>
 /// simplest way to log a start and end pair
 /// </summary>
 public static IDisposable LogBlock(FunctionId functionId, CancellationToken token, LogLevel logLevel = LogLevel.Trace)
 => LogBlock(functionId, string.Empty, token, logLevel);
Beispiel #9
0
 private static bool GetDefaultValue(FunctionId id)
 {
     return(id != FunctionId.FindReference_ProcessDocumentAsync);
 }
 public static LogBlock LogInformationalBlock(FunctionId functionId, object entity, CancellationToken cancellationToken)
 => LogBlock.Create(functionId, entity, EventLevel.Informational, cancellationToken);
 public static LogBlock LogInformationalBlock(FunctionId functionId, string message, CancellationToken cancellationToken)
 => LogBlock.Create(functionId, message, EventLevel.Informational, cancellationToken);
Beispiel #12
0
 public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
 {
     RoslynEventSource.Instance.BlockStart(GetMessage(logMessage), functionId, uniquePairId);
 }
Beispiel #13
0
 public void Log(FunctionId functionId, LogMessage logMessage)
 {
     source.Log(GetMessage(logMessage), functionId);
 }
Beispiel #14
0
 public bool IsEnabled(FunctionId functionId)
 {
     return(source.IsEnabled() && (this.loggingChecker == null || this.loggingChecker(functionId)));
 }
Beispiel #15
0
 public void BlockStart(string message, FunctionId functionId, int blockId)
 {
     WriteEvent(2, message ?? string.Empty, (int)functionId, blockId);
 }
Beispiel #16
0
 public static Option <bool> GetOption(FunctionId id)
 {
     return(options.GetOrAdd(id, optionGetter));
 }
Beispiel #17
0
 public void BlockStop(FunctionId functionId, int tick, int blockId)
 {
     WriteEvent(3, (int)functionId, tick, blockId);
 }
Beispiel #18
0
        private static bool GetDefaultValue(FunctionId id)
        {
            switch (id)
            {
            case FunctionId.TestEvent_NotUsed:
                return(false);

            case FunctionId.Tagger_AdornmentManager_OnLayoutChanged:
            case FunctionId.Tagger_AdornmentManager_UpdateInvalidSpans:
            case FunctionId.Tagger_BatchChangeNotifier_NotifyEditorNow:
            case FunctionId.Tagger_BatchChangeNotifier_NotifyEditor:
            case FunctionId.Tagger_TagSource_ProcessNewTags:
            case FunctionId.Tagger_SyntacticClassification_TagComputer_GetTags:
            case FunctionId.Tagger_SemanticClassification_TagProducer_ProduceTags:
            case FunctionId.Tagger_BraceHighlighting_TagProducer_ProduceTags:
            case FunctionId.Tagger_LineSeparator_TagProducer_ProduceTags:
            case FunctionId.Tagger_Outlining_TagProducer_ProduceTags:
            case FunctionId.Tagger_Highlighter_TagProducer_ProduceTags:
            case FunctionId.Tagger_ReferenceHighlighting_TagProducer_ProduceTags:
                return(false);

            case FunctionId.Workspace_SourceText_GetChangeRanges:
            case FunctionId.Workspace_Recoverable_RecoverRootAsync:
            case FunctionId.Workspace_Recoverable_RecoverRoot:
            case FunctionId.Workspace_Recoverable_RecoverTextAsync:
            case FunctionId.Workspace_Recoverable_RecoverText:
                return(false);

            case FunctionId.Misc_NonReentrantLock_BlockingWait:
                return(false);

            case FunctionId.Cache_Created:
            case FunctionId.Cache_AddOrAccess:
            case FunctionId.Cache_Remove:
            case FunctionId.Cache_Evict:
            case FunctionId.Cache_EvictAll:
            case FunctionId.Cache_ItemRank:
                return(false);

            case FunctionId.Simplifier_ReduceAsync:
            case FunctionId.Simplifier_ExpandNode:
            case FunctionId.Simplifier_ExpandToken:
                return(false);

            case FunctionId.TemporaryStorageServiceFactory_ReadText:
            case FunctionId.TemporaryStorageServiceFactory_WriteText:
            case FunctionId.TemporaryStorageServiceFactory_ReadStream:
            case FunctionId.TemporaryStorageServiceFactory_WriteStream:
                return(false);

            case FunctionId.WorkCoordinator_DocumentWorker_Enqueue:
            case FunctionId.WorkCoordinator_ProcessProjectAsync:
            case FunctionId.WorkCoordinator_ProcessDocumentAsync:
            case FunctionId.WorkCoordinator_SemanticChange_Enqueue:
            case FunctionId.WorkCoordinator_SemanticChange_EnqueueFromMember:
            case FunctionId.WorkCoordinator_SemanticChange_EnqueueFromType:
            case FunctionId.WorkCoordinator_SemanticChange_FullProjects:
            case FunctionId.WorkCoordinator_Project_Enqueue:
                return(false);

            case FunctionId.Diagnostics_SyntaxDiagnostic:
            case FunctionId.Diagnostics_SemanticDiagnostic:
            case FunctionId.Diagnostics_ProjectDiagnostic:
            case FunctionId.Diagnostics_DocumentReset:
            case FunctionId.Diagnostics_DocumentOpen:
            case FunctionId.Diagnostics_RemoveDocument:
            case FunctionId.Diagnostics_RemoveProject:
                return(false);

            default:
                return(true);
            }
        }
Beispiel #19
0
 public bool IsEnabled(FunctionId functionId)
 => false;
Beispiel #20
0
 public void Log(FunctionId functionId, LogMessage logMessage)
 => Log(functionId, logMessage.GetMessage());
Beispiel #21
0
 public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
 {
 }
Beispiel #22
0
 public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
 => LogBlockEvent(functionId, logMessage, uniquePairId, "BlockStart");
Beispiel #23
0
 public bool IsEnabled(FunctionId functionId)
 {
     return(true);
 }
Beispiel #24
0
 public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
 => LogBlockEvent(functionId, logMessage, uniquePairId, cancellationToken.IsCancellationRequested ? "BlockCancelled" : "BlockEnd");
 public void Log(FunctionId functionId, LogMessage logMessage)
 {
     OutputPane.WriteLine(string.Format("[{0}] {1} - {2}", Thread.CurrentThread.ManagedThreadId, functionId.ToString(), logMessage.GetMessage()));
 }
Beispiel #26
0
 private void LogBlockEvent(FunctionId functionId, LogMessage logMessage, int uniquePairId, string blockEvent)
 => Log(functionId, $"[{blockEvent} - {uniquePairId}] {logMessage.GetMessage()}");
        public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
        {
            var functionString = functionId.ToString() + (cancellationToken.IsCancellationRequested ? " Canceled" : string.Empty);

            OutputPane.WriteLine(string.Format("[{0}] End({1}) : [{2}ms] {3}", Thread.CurrentThread.ManagedThreadId, uniquePairId, delta, functionString));
        }
Beispiel #28
0
 public void Log(string message, FunctionId functionId)
 {
     WriteEvent(1, message ?? string.Empty, (int)functionId);
 }
Beispiel #29
0
 /// <summary>
 /// simplest way to log a start and end pair
 /// </summary>
 public static IDisposable LogBlock(FunctionId functionId, CancellationToken token)
 {
     return(LogBlock(functionId, string.Empty, token));
 }
Beispiel #30
0
 /// <summary>
 /// log a start and end pair with a context message that requires some arguments to be created when requested.
 /// given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals
 /// </summary>
 public static IDisposable LogBlock <TArg0, TArg1, TArg2, TArg3>(FunctionId functionId, Func <TArg0, TArg1, TArg2, TArg3, string> messageGetter, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, CancellationToken token, LogLevel logLevel = LogLevel.Trace)
 => TryGetActiveLogger(functionId, out _) ?
 CreateLogBlock(functionId, LogMessage.Create(messageGetter, arg0, arg1, arg2, arg3, logLevel), GetNextUniqueBlockId(), token) :
 EmptyLogBlock.Instance;