public void LogSource(IDiagnosticLogger logger) { if (logger == null) throw new ArgumentNullException("logger"); logger.LoadedFluentMappingsFromSource(this); }
/// <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; }
public AttachToAnythingController(Package package, DTE dte, AttachTargetOptionPage options, ProcessWaitSource waitSource, IDiagnosticLogger logger) { _package = package; _dte = dte; _options = options; _waitSource = waitSource; _logger = logger; }
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; }
public MappingConfiguration(IDiagnosticLogger logger) { this.logger = logger; FluentMappings = new FluentMappingsContainer(); FluentMappings.PersistenceModel.SetLogger(logger); AutoMappings = new AutoMappingsContainer(); HbmMappings = new HbmMappingsContainer(); }
public void CreateMappingConfiguration() { logger = Stub<IDiagnosticLogger>.Create(); cfg = new Configuration(); SQLiteConfiguration.Standard .InMemory() .ConfigureProperties(cfg); mapping = new MappingConfiguration(logger); }
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); }
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); }
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; }
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); } }
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); } }
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); } }
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); } }
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; }
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); } }
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); } }
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; }
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())); } }
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); } }
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); }
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); } }
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); }
/// <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)); } }
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); } }
public static void LogDebug <TArg>( this IDiagnosticLogger logger, string message, TArg arg) => logger.LogIfEnabled(SentryLevel.Debug, message, arg);
public static void LogError <TArg>( this IDiagnosticLogger logger, string message, Exception exception, TArg arg) => logger.LogIfEnabled(SentryLevel.Error, message, exception, arg);
public static void LogWarning <TArg, TArg2>( this IDiagnosticLogger logger, string message, TArg arg, TArg2 arg2) => logger.LogIfEnabled(SentryLevel.Warning, message, arg, arg2);
public static void LogWarning( this IDiagnosticLogger logger, string message) => logger.LogIfEnabled(SentryLevel.Warning, message);
public ProcessWaitSource(IDiagnosticLogger logger) { _logger = logger; IsEfficient = true; }
public void SetLogger(IDiagnosticLogger logger) { log = logger; Conventions.SetLogger(logger); }
public void LogSource(IDiagnosticLogger logger) { foreach (var source in sources) source.LogSource(logger); }
public void LogSource(IDiagnosticLogger logger) { logger.LoadedFluentMappingsFromSource(this); }
public RestoreCommand(CompilationService compilationService, IDiagnosticLogger diagnosticLogger) { this.compilationService = compilationService; this.diagnosticLogger = diagnosticLogger; }
public void LogSource(IDiagnosticLogger logger) { }
public void LogSource(IDiagnosticLogger logger) { _innerTypeSource.LogSource(logger); }
public static void LogFatal( this IDiagnosticLogger logger, string message, Exception?exception = null) => logger.LogIfEnabled(SentryLevel.Fatal, message, exception);
/// <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(); }
static MyService() { Logger = GlobalDiagnostics.CreateLoggerForThisType(); }
public void LogSource(IDiagnosticLogger logger) { throw new NotImplementedException(); }
public void SetLogger(IDiagnosticLogger logger) { conventionFinder.SetLogger(logger); }
public TelegramReporter(string connectionString, IDiagnosticLogger logger) { ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); Logs = new List <Log>(); }
/// <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); }
public SentrySdkTests(ITestOutputHelper testOutputHelper) { _logger = new TestOutputDiagnosticLogger(testOutputHelper); }