コード例 #1
0
        public void LogSource(IDiagnosticLogger logger)
        {
            if (logger == null) 
                throw new ArgumentNullException("logger");

            logger.LoadedFluentMappingsFromSource(this);
        }
コード例 #2
0
        /// <summary>
        /// Configure diagnostic logging
        /// </summary>
        /// <param name="diagnosticsSetup">Diagnostic configuration</param>
        public FluentConfiguration Diagnostics(Action<DiagnosticsConfiguration> diagnosticsSetup)
        {
            var diagnosticsCfg = new DiagnosticsConfiguration(despatcher, new_logger => logger = new_logger);

            diagnosticsSetup(diagnosticsCfg);

            return this;
        }
コード例 #3
0
 public AttachToAnythingController(Package package, DTE dte, AttachTargetOptionPage options, ProcessWaitSource waitSource, IDiagnosticLogger logger)
 {
     _package = package;
     _dte = dte;
     _options = options;
     _waitSource = waitSource;
     _logger = logger;
 }
コード例 #4
0
        public ExceptionBreakManager(DebugSessionManager sessionManager, Func<string, bool> ignorePredicate, IDiagnosticLogger logger) {
            _sessionManager = sessionManager;
            _ignorePredicate = ignorePredicate;
            _logger = logger;

            if (Session != null)
                _currentState = GetStateFromSession();
            _sessionManager.DebugSessionChanged += sessionManager_DebugSessionChanged;
        }
コード例 #5
0
        public MappingConfiguration(IDiagnosticLogger logger)
        {
            this.logger = logger;

            FluentMappings = new FluentMappingsContainer();
            FluentMappings.PersistenceModel.SetLogger(logger);

            AutoMappings = new AutoMappingsContainer();
            HbmMappings = new HbmMappingsContainer();
        }
コード例 #6
0
        public void CreateMappingConfiguration()
        {
            logger = Stub<IDiagnosticLogger>.Create();
            cfg = new Configuration();

            SQLiteConfiguration.Standard
                .InMemory()
                .ConfigureProperties(cfg);

            mapping = new MappingConfiguration(logger);
        }
コード例 #7
0
        public DebugSessionManager(IDebuggerInternalAdapter debugger, IDiagnosticLogger logger) {
            _debugger = debugger;
            _logger = logger;

            _eventSink = new DebugSessionEventSink();
            _eventSink.SessionCreated += (sender, args) => ProcessSessionCreateOrDestoryEvent("created");
            _eventSink.SessionDestroyed += (sender, args) => ProcessSessionCreateOrDestoryEvent("destroyed");

            var hr = _debugger.RegisterInternalEventSink(_eventSink);
            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: wpouseele/bicep
        private static bool LogDiagnosticsAndCheckSuccess(IDiagnosticLogger logger, Compilation compilation)
        {
            var success = true;

            foreach (var(syntaxTree, diagnostics) in compilation.GetAllDiagnosticsBySyntaxTree())
            {
                foreach (var diagnostic in diagnostics)
                {
                    logger.LogDiagnostic(syntaxTree.FileUri, diagnostic, syntaxTree.LineStarts);
                    success &= diagnostic.Level != DiagnosticLevel.Error;
                }
            }

            return(success);
        }
コード例 #9
0
 public PublishCommand(
     IDiagnosticLogger diagnosticLogger,
     CompilationService compilationService,
     CompilationWriter compilationWriter,
     IModuleDispatcher moduleDispatcher,
     IConfigurationManager configurationManager,
     IFileSystem fileSystem)
 {
     this.diagnosticLogger     = diagnosticLogger;
     this.compilationService   = compilationService;
     this.compilationWriter    = compilationWriter;
     this.moduleDispatcher     = moduleDispatcher;
     this.configurationManager = configurationManager;
     this.fileSystem           = fileSystem;
 }
コード例 #10
0
 internal static void LogIfEnabled <TArg, TArg2, TArg3, TArg4>(
     this IDiagnosticLogger logger,
     SentryLevel level,
     Exception?exception,
     string message,
     TArg arg,
     TArg2 arg2,
     TArg3 arg3,
     TArg4 arg4)
 {
     if (logger.IsEnabled(level))
     {
         logger.Log(level, message, exception, arg, arg2, arg3, arg4);
     }
 }
コード例 #11
0
ファイル: Program.cs プロジェクト: charotAmine/bicep
        private void BuildSingleFile(IDiagnosticLogger logger, string bicepPath, string outputPath)
        {
            var syntaxTreeGrouping = SyntaxTreeGroupingBuilder.Build(new FileResolver(), new Workspace(), PathHelper.FilePathToFileUrl(bicepPath));
            var compilation        = new Compilation(resourceTypeProvider, syntaxTreeGrouping);

            var success = LogDiagnosticsAndCheckSuccess(logger, compilation);

            if (success)
            {
                var emitter = new TemplateEmitter(compilation.GetEntrypointSemanticModel());

                using var outputStream = CreateFileStream(outputPath);
                emitter.Emit(outputStream);
            }
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: ryanazuretest/bicep
        private static void BuildSingleFile(IDiagnosticLogger logger, string bicepPath, string outputPath)
        {
            string text       = File.ReadAllText(bicepPath);
            var    lineStarts = TextCoordinateConverter.GetLineStarts(text);

            var compilation = new Compilation(SyntaxFactory.CreateFromText(text));

            var emitter = new TemplateEmitter(compilation.GetSemanticModel());

            var result = emitter.Emit(outputPath);

            foreach (var diagnostic in result.Diagnostics)
            {
                logger.LogDiagnostic(bicepPath, diagnostic, lineStarts);
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: ikemerrix/bicep
        private void Build(IDiagnosticLogger logger, BuildArguments arguments)
        {
            var bicepPaths = arguments.Files.Select(PathHelper.ResolvePath).ToArray();

            if (arguments.OutputToStdOut)
            {
                BuildManyFilesToStdOut(logger, bicepPaths);
                return;
            }

            foreach (string bicepPath in bicepPaths)
            {
                string outputPath = PathHelper.GetDefaultOutputPath(bicepPath);
                BuildSingleFile(logger, bicepPath, outputPath);
            }
        }
コード例 #14
0
 public CompilationService(
     IDiagnosticLogger diagnosticLogger,
     IFileResolver fileResolver,
     InvocationContext invocationContext,
     IModuleDispatcher moduleDispatcher,
     IConfigurationManager configurationManager,
     TemplateDecompiler decompiler)
 {
     this.diagnosticLogger     = diagnosticLogger;
     this.fileResolver         = fileResolver;
     this.moduleDispatcher     = moduleDispatcher;
     this.configurationManager = configurationManager;
     this.invocationContext    = invocationContext;
     this.workspace            = new Workspace();
     this.decompiler           = decompiler;
 }
コード例 #15
0
        public DebugSessionManager(IDebuggerInternalAdapter debugger, IDiagnosticLogger logger)
        {
            _debugger = debugger;
            _logger   = logger;

            _eventSink = new DebugSessionEventSink();
            _eventSink.SessionCreated   += (sender, args) => ProcessSessionCreateOrDestoryEvent("created");
            _eventSink.SessionDestroyed += (sender, args) => ProcessSessionCreateOrDestoryEvent("destroyed");

            var hr = _debugger.RegisterInternalEventSink(_eventSink);

            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }
        }
コード例 #16
0
        private void BuildSingleFile(IDiagnosticLogger logger, string bicepPath, string outputPath)
        {
            string text       = ReadFile(bicepPath);
            var    lineStarts = TextCoordinateConverter.GetLineStarts(text);

            var compilation = new Compilation(resourceTypeProvider, SyntaxFactory.CreateFromText(text));

            var emitter = new TemplateEmitter(compilation.GetSemanticModel());

            using var outputStream = CreateFileStream(outputPath);
            var result = emitter.Emit(outputStream);

            foreach (var diagnostic in result.Diagnostics)
            {
                logger.LogDiagnostic(bicepPath, diagnostic, lineStarts);
            }
        }
コード例 #17
0
        public SolutionIconManager(DTE dte, IconFinder iconFinder, IconConverter iconConverter, IconGenerator iconGenerator, IDiagnosticLogger logger)
        {
            _dte           = dte;
            _iconFinder    = iconFinder;
            _iconConverter = iconConverter;
            _iconGenerator = iconGenerator;
            _logger        = logger;

            if (!TaskbarManager.IsPlatformSupported)
            {
                _logger.WriteLine("Overlay icons are not supported on this platform, exiting.");
                return;
            }

            _solutionEvents               = _dte.Events.SolutionEvents;
            _solutionEvents.Opened       += SolutionEvents_Opened;
            _solutionEvents.AfterClosing += SolutionEvents_AfterClosing;
        }
コード例 #18
0
        public static async Task <string> SerializeToStringAsync(
            this ISerializable serializable,
            IDiagnosticLogger logger,
            CancellationToken cancellationToken = default)
        {
            var stream = new MemoryStream();

#if NET461 || NETSTANDARD2_0
            using (stream)
#else
            await using (stream.ConfigureAwait(false))
#endif
            {
                await serializable.SerializeAsync(stream, logger, cancellationToken).ConfigureAwait(false);

                return(Encoding.UTF8.GetString(stream.ToArray()));
            }
        }
コード例 #19
0
ファイル: Program.cs プロジェクト: davidallyoung/bicep
        private void BuildToStdout(IDiagnosticLogger logger, string bicepPath)
        {
            using var writer = new JsonTextWriter(this.outputWriter)
                  {
                      Formatting = Formatting.Indented
                  };

            var syntaxTreeGrouping = SyntaxTreeGroupingBuilder.Build(new FileResolver(), new Workspace(), PathHelper.FilePathToFileUrl(bicepPath));
            var compilation        = new Compilation(resourceTypeProvider, syntaxTreeGrouping);

            var success = LogDiagnosticsAndCheckSuccess(logger, compilation);

            if (success)
            {
                var emitter = new TemplateEmitter(compilation.GetEntrypointSemanticModel(), this.assemblyFileVersion);

                emitter.Emit(writer);
            }
        }
コード例 #20
0
        public CommandController(DTE dte,
                                 Func <EventHandler, MenuCommand> initBreakOnAllCommand,
                                 IVsMonitorSelection monitorSelection,
                                 ExceptionBreakManager breakManager,
                                 IDiagnosticLogger logger)
        {
            _monitorSelection  = monitorSelection;
            _breakManager      = breakManager;
            _logger            = logger;
            _breakOnAllCommand = initBreakOnAllCommand(breakOnAllCommand_Callback);

            _requiredUiContextCookies = new HashSet <uint>(RequiredUIContexts.Select(ConvertToUIContextCookie));

            UpdateCommandAvailability();
            _selectionEventsCookie = SubscribeToSelectionEvents();

            UpdateCommandCheckedState();
            _breakManager.CurrentStateChanged += breakManager_CurrentStateChanged;

            _debugExceptionsEvents = SubscribeToDebugExceptionsCommand(dte);
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: yane3628/bicep
        private bool DecompileSingleFile(IDiagnosticLogger logger, string filePath)
        {
            try
            {
                var(bicepUri, filesToSave) = TemplateDecompiler.DecompileFileWithModules(resourceTypeProvider, new FileResolver(), PathHelper.FilePathToFileUrl(filePath));
                foreach (var(fileUri, bicepOutput) in filesToSave)
                {
                    File.WriteAllText(fileUri.LocalPath, bicepOutput);
                }

                var syntaxTreeGrouping = SyntaxTreeGroupingBuilder.Build(new FileResolver(), new Workspace(), bicepUri);
                var compilation        = new Compilation(resourceTypeProvider, syntaxTreeGrouping);

                return(LogDiagnosticsAndCheckSuccess(logger, compilation));
            }
            catch (Exception exception)
            {
                this.errorWriter.WriteLine($"{filePath}: Decompilation failed with fatal error \"{exception.Message}\"");
                return(false);
            }
        }
コード例 #22
0
        public CommandController(DTE dte,
            Func<EventHandler, MenuCommand> initBreakOnAllCommand,
            IVsMonitorSelection monitorSelection,
            ExceptionBreakManager breakManager,
            IDiagnosticLogger logger)
        {
            _monitorSelection = monitorSelection;
            _breakManager = breakManager;
            _logger = logger;
            _breakOnAllCommand = initBreakOnAllCommand(breakOnAllCommand_Callback);

            _requiredUiContextCookies = new HashSet<uint>(RequiredUIContexts.Select(ConvertToUIContextCookie));

            UpdateCommandAvailability();
            _selectionEventsCookie = SubscribeToSelectionEvents();

            UpdateCommandCheckedState();
            _breakManager.CurrentStateChanged += breakManager_CurrentStateChanged;

            _debugExceptionsEvents = SubscribeToDebugExceptionsCommand(dte);
        }
コード例 #23
0
        /// <inheritdoc cref="ITaskRunner.StartTask(Func{CancellationToken, Task})"/>
        /// <param name="logger">Optional logger to output diagnostic messages to.</param>
        public Task StartTask(
            Func <CancellationToken, Task> taskCreator,
            IDiagnosticLogger logger)
        {
            if (taskCreator is null)
            {
                throw new ArgumentNullException(nameof(taskCreator));
            }
            if (this.isDisposed)
            {
                throw new ObjectDisposedException(nameof(LocalTaskRunner));
            }

            // Activate our context and wrap the task.
            using (var contextScope = ContextScope.WithContext(this.context))
            {
                var diagTracer = logger is null ? null : DiagTaskTracer.Create(logger, taskCreator);
                diagTracer?.LogInvoked();
                return(this.WrapTask(taskCreator.Invoke(this.cancelSource.Token), diagTracer));
            }
        }
コード例 #24
0
ファイル: Program.cs プロジェクト: davidallyoung/bicep
        private int DecompileToFile(IDiagnosticLogger logger, string jsonPath, string outputPath)
        {
            try
            {
                var(_, filesToSave) = TemplateDecompiler.DecompileFileWithModules(resourceTypeProvider, new FileResolver(), PathHelper.FilePathToFileUrl(jsonPath));
                foreach (var(_, bicepOutput) in filesToSave)
                {
                    File.WriteAllText(outputPath, bicepOutput);
                }

                var outputPathToCheck  = Path.GetFullPath(outputPath);
                var syntaxTreeGrouping = SyntaxTreeGroupingBuilder.Build(new FileResolver(), new Workspace(), PathHelper.FilePathToFileUrl(outputPathToCheck));
                var compilation        = new Compilation(resourceTypeProvider, syntaxTreeGrouping);

                return(LogDiagnosticsAndCheckSuccess(logger, compilation) ? 0 : 1);
            }
            catch (Exception exception)
            {
                this.errorWriter.WriteLine($"{jsonPath}: Decompilation failed with fatal error \"{exception.Message}\"");
                return(1);
            }
        }
コード例 #25
0
 public static void LogDebug <TArg>(
     this IDiagnosticLogger logger,
     string message,
     TArg arg)
 => logger.LogIfEnabled(SentryLevel.Debug, message, arg);
コード例 #26
0
 public static void LogError <TArg>(
     this IDiagnosticLogger logger,
     string message,
     Exception exception,
     TArg arg)
 => logger.LogIfEnabled(SentryLevel.Error, message, exception, arg);
コード例 #27
0
 public static void LogWarning <TArg, TArg2>(
     this IDiagnosticLogger logger,
     string message,
     TArg arg,
     TArg2 arg2)
 => logger.LogIfEnabled(SentryLevel.Warning, message, arg, arg2);
コード例 #28
0
 public static void LogWarning(
     this IDiagnosticLogger logger,
     string message)
 => logger.LogIfEnabled(SentryLevel.Warning, message);
コード例 #29
0
 public ProcessWaitSource(IDiagnosticLogger logger)
 {
     _logger = logger;
     IsEfficient = true;
 }
コード例 #30
0
 public void SetLogger(IDiagnosticLogger logger)
 {
     log = logger;
     Conventions.SetLogger(logger);
 }
コード例 #31
0
 public void LogSource(IDiagnosticLogger logger)
 {
     foreach (var source in sources)
         source.LogSource(logger);
 }
コード例 #32
0
 public void LogSource(IDiagnosticLogger logger)
 {
     logger.LoadedFluentMappingsFromSource(this);
 }
コード例 #33
0
 public RestoreCommand(CompilationService compilationService, IDiagnosticLogger diagnosticLogger)
 {
     this.compilationService = compilationService;
     this.diagnosticLogger   = diagnosticLogger;
 }
コード例 #34
0
 public void LogSource(IDiagnosticLogger logger)
 {
 }
コード例 #35
0
ファイル: FilterableTypeSource.cs プロジェクト: drwill/Quarks
		public void LogSource(IDiagnosticLogger logger)
		{
			_innerTypeSource.LogSource(logger);
		}
コード例 #36
0
 public void LogSource(IDiagnosticLogger logger)
 {
 }
コード例 #37
0
 public static void LogFatal(
     this IDiagnosticLogger logger,
     string message,
     Exception?exception = null)
 => logger.LogIfEnabled(SentryLevel.Fatal, message, exception);
コード例 #38
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this));
            base.Initialize();
            Logger = new ExtensionLogger("ExceptionBreaker", paneCaption => GetOutputPane(GuidList.OutputPane, paneCaption));

            _dte = (DTE)GetService(typeof(DTE));
            SetupExceptionBreakManager();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            SetupCommandController();
        }
コード例 #39
0
 static MyService()
 {
     Logger = GlobalDiagnostics.CreateLoggerForThisType();
 }
コード例 #40
0
ファイル: DataUtility.cs プロジェクト: yanghl22/Orchard
 public void LogSource(IDiagnosticLogger logger)
 {
     throw new NotImplementedException();
 }
コード例 #41
0
 public void LogSource(IDiagnosticLogger logger)
 {
     throw new NotImplementedException();
 }
コード例 #42
0
 public void SetLogger(IDiagnosticLogger logger)
 {
     conventionFinder.SetLogger(logger);
 }
コード例 #43
0
 public TelegramReporter(string connectionString, IDiagnosticLogger logger)
 {
     ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     Logs             = new List <Log>();
 }
コード例 #44
0
 public void LogSource(IDiagnosticLogger logger)
 {
     _innerTypeSource.LogSource(logger);
 }
コード例 #45
0
        /// <summary>
        /// Configure diagnostic logging
        /// </summary>
        /// <param name="diagnosticsSetup">Diagnostic configuration</param>
        public FluentConfiguration Diagnostics(Action <DiagnosticsConfiguration> diagnosticsSetup)
        {
            var diagnosticsCfg = new DiagnosticsConfiguration(despatcher, new_logger => logger = new_logger);

            diagnosticsSetup(diagnosticsCfg);

            return(this);
        }
コード例 #46
0
 public SentrySdkTests(ITestOutputHelper testOutputHelper)
 {
     _logger = new TestOutputDiagnosticLogger(testOutputHelper);
 }