Exemple #1
0
 public IEnumerable <IOption> GetOptions()
 {
     foreach (var id in (FunctionId[])Enum.GetValues(typeof(FunctionId)))
     {
         yield return(FunctionIdOptions.GetOption(id));
     }
 }
 protected override ILogger CreateLogger(TelemetrySession telemetrySession)
 => AggregateLogger.Create(
     CodeMarkerLogger.Instance,
     new EtwLogger(FunctionIdOptions.CreateFunctionIsEnabledPredicate(_globalOptions)),
     TelemetryLogger.Create(telemetrySession, _globalOptions),
     new FileLogger(_globalOptions),
     Logger.GetLogger());
Exemple #3
0
        /// <summary>
        /// let ones such as Perf setup to share loggingChecker func
        /// </summary>
        internal static Func <FunctionId, bool> GetLoggingChecker(IOptionService optionsService)
        {
            var functionIds       = Enum.GetValues(typeof(FunctionId)).Cast <FunctionId>();
            var functionIdOptions = functionIds.ToDictionary(
                id => id, id => optionsService.GetOption(FunctionIdOptions.GetOption(id)));

            Func <FunctionId, bool> loggingChecker = (functionId) => functionIdOptions[functionId];

            return(loggingChecker);
        }
Exemple #4
0
        protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
        {
            if (_globalOptions == null)
            {
                var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));

                _globalOptions    = componentModel.GetService <IGlobalOptionService>();
                _threadingContext = componentModel.GetService <IThreadingContext>();

                var workspace = componentModel.GetService <VisualStudioWorkspace>();
                _workspaceServices = workspace.Services;
            }

            return(new InternalOptionsControl(FunctionIdOptions.GetOptions(), optionStore));
        }
Exemple #5
0
        public static void SetLoggers(IGlobalOptionService globalOptions, IThreadingContext threadingContext, HostWorkspaceServices workspaceServices)
        {
            var loggerTypeNames = GetLoggerTypes(globalOptions).ToImmutableArray();

            // update loggers in VS
            var isEnabled = FunctionIdOptions.CreateFunctionIsEnabledPredicate(globalOptions);

            SetRoslynLogger(loggerTypeNames, () => new EtwLogger(isEnabled));
            SetRoslynLogger(loggerTypeNames, () => new TraceLogger(isEnabled));
            SetRoslynLogger(loggerTypeNames, () => new OutputWindowLogger(isEnabled));

            // update loggers in remote process
            var client = threadingContext.JoinableTaskFactory.Run(() => RemoteHostClient.TryGetClientAsync(workspaceServices, CancellationToken.None));

            if (client != null)
            {
                var functionIds = Enum.GetValues(typeof(FunctionId)).Cast <FunctionId>().Where(isEnabled).ToImmutableArray();

                threadingContext.JoinableTaskFactory.Run(async() => _ = await client.TryInvokeAsync <IRemoteProcessTelemetryService>(
                                                             (service, cancellationToken) => service.EnableLoggingAsync(loggerTypeNames, functionIds, cancellationToken),
                                                             CancellationToken.None).ConfigureAwait(false));
            }
        }
Exemple #6
0
 protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
 {
     return(new InternalOptionsControl(FunctionIdOptions.GetOptions(), optionStore));
 }