├── content ├── screenshots │ └── main.png └── images │ ├── diol-main-banner.png │ └── diol-main-image.png ├── source └── Diol │ ├── src │ ├── applications │ │ ├── DiolVSIX │ │ │ ├── Resources │ │ │ │ ├── logo.png │ │ │ │ ├── DiolCommandLogo.png │ │ │ │ └── DiolToolWindowCommand.png │ │ │ ├── publishManifest.json │ │ │ ├── DiolToolWindowControl.xaml.cs │ │ │ ├── Services │ │ │ │ ├── VsProcessProvider.cs │ │ │ │ └── VsApplicationStateService.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── DiolToolWindow.cs │ │ │ ├── DiolVSIXPackage1.cs │ │ │ ├── source.extension.vsixmanifest │ │ │ ├── DiolBootstrapper.cs │ │ │ ├── DiolVSIXPackage.cs │ │ │ ├── DiolToolWindowCommand.cs │ │ │ └── DiolVSIXPackage.vsct │ │ ├── DiolBackendService │ │ │ ├── appsettings.Development.json │ │ │ ├── Properties │ │ │ │ └── launchSettings.json │ │ │ ├── Pages │ │ │ │ └── Index.cshtml.cs │ │ │ ├── Program.cs │ │ │ ├── appsettings.json │ │ │ ├── ReadME.md │ │ │ ├── setup.ps1 │ │ │ └── DiolBackendService.csproj │ │ ├── Diol.applications.WpfClient │ │ │ ├── App.xaml │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Diol.applications.WpfClient.csproj │ │ │ └── App.xaml.cs │ │ └── Diol.applications.ConsoleClient │ │ │ ├── Diol.applications.ConsoleClient.csproj │ │ │ ├── ConsoleConsumer.cs │ │ │ └── Program.cs │ ├── Diol.Share │ │ ├── Diol.Share.csproj │ │ ├── Consumers │ │ │ └── IConsumer.cs │ │ ├── Utils │ │ │ └── DotnetProcessInfo.cs │ │ ├── Services │ │ │ ├── IApplicationStateService.cs │ │ │ ├── IProcessProvider.cs │ │ │ ├── DotnetProcessesService.cs │ │ │ └── SqlQueryService.cs │ │ └── Features │ │ │ ├── EntityFrameworks │ │ │ ├── CommandExecutedDto.cs │ │ │ ├── ConnectionOpeningDto.cs │ │ │ └── CommandExecutingDto.cs │ │ │ ├── Httpclients │ │ │ ├── RequestPipelineResponseHeaderDto.cs │ │ │ ├── RequestPipelineRequestHeaderDto.cs │ │ │ ├── RequestPipelineEndDto.cs │ │ │ └── RequestPipelineStartDto.cs │ │ │ ├── Aspnetcores │ │ │ ├── RequestBodyDto.cs │ │ │ ├── ResponseBodyDto.cs │ │ │ ├── ResponseLogDto.cs │ │ │ └── RequestLogDto.cs │ │ │ └── BaseDto.cs │ ├── Diol.Aspnet │ │ ├── Pages │ │ │ └── Index.cshtml.cs │ │ ├── Diol.Aspnet.csproj │ │ ├── ServiceCollection.cs │ │ ├── Hubs │ │ │ └── LogsHub.cs │ │ ├── Consumers │ │ │ └── SignalRConsumer.cs │ │ └── BackgroundWorkers │ │ │ └── LogsBackgroundWorker.cs │ ├── Diol.Core │ │ ├── Diol.Core.csproj │ │ ├── DiagnosticClients │ │ │ ├── EventPipeHelper.cs │ │ │ ├── EventPipeEventSourceBuilder.cs │ │ │ └── EventPipeEventSourceWrapper.cs │ │ ├── TraceEventProcessors │ │ │ ├── EventPublisherUnsubscriber.cs │ │ │ ├── TraceEventRouterUnsubscriber.cs │ │ │ ├── IProcessor.cs │ │ │ ├── EventPublisher.cs │ │ │ ├── ProcessorFactory.cs │ │ │ └── TraceEventRouter.cs │ │ ├── Utils │ │ │ └── Utilities.cs │ │ ├── ServiceCollectionExtensions.cs │ │ └── Features │ │ │ └── BaseProcessor.cs │ └── Diol.Wpf.Core │ │ ├── Views │ │ ├── MainWindow.xaml │ │ ├── MainWindow.xaml.cs │ │ ├── HttpMaster.xaml.cs │ │ ├── AspnetMaster.xaml.cs │ │ ├── MainComponent.xaml.cs │ │ ├── DiolComponent.xaml.cs │ │ ├── AspnetComponent.xaml.cs │ │ ├── DiagnosticsView.xaml.cs │ │ ├── HttpComponent.xaml.cs │ │ ├── WelcomeComponent.xaml.cs │ │ ├── EntityFrameworkDetail.xaml.cs │ │ ├── EntityFrameworkMaster.xaml.cs │ │ ├── EntityFrameworkComponent.xaml.cs │ │ ├── DiolComponent.xaml │ │ ├── HttpComponent.xaml │ │ ├── AspnetComponent.xaml │ │ ├── EntityFrameworkComponent.xaml │ │ ├── HttpDetail.xaml.cs │ │ ├── AspnetDetail.xaml.cs │ │ ├── DiagnosticsView.xaml │ │ ├── WelcomeComponent.xaml │ │ ├── MainComponent.xaml │ │ ├── EntityFrameworkDetail.xaml │ │ ├── EntityFrameworkMaster.xaml │ │ ├── AspnetMaster.xaml │ │ └── HttpMaster.xaml │ │ ├── Diol.Wpf.Core.csproj │ │ ├── Features │ │ ├── Https │ │ │ ├── HttpEvents.cs │ │ │ ├── HttpModel.cs │ │ │ └── HttpViewModel.cs │ │ ├── Aspnetcores │ │ │ ├── AspnetEvents.cs │ │ │ ├── AspnetcoreModel.cs │ │ │ ├── AspnetViewModel.cs │ │ │ └── AspnetService.cs │ │ ├── EntityFrameworks │ │ │ ├── EntityFrameworkModel.cs │ │ │ ├── EntityFrameworkEvents.cs │ │ │ └── EntityFrameworkViewModel.cs │ │ └── Shared │ │ │ └── SharedEvents.cs │ │ ├── Services │ │ ├── RelayCommand.cs │ │ ├── DiolBuilder.cs │ │ ├── DiolExecutor.cs │ │ ├── LocalStore.cs │ │ └── WpfConsumer.cs │ │ ├── MainModule.cs │ │ └── ViewModels │ │ ├── DiagnosticsViewModel.cs │ │ ├── HttpComponentViewModel.cs │ │ ├── AspnetComponentViewModel.cs │ │ ├── EntityFrameworkComponentViewModel.cs │ │ ├── WelcomeComponentViewModel.cs │ │ ├── AspnetMasterViewModel.cs │ │ ├── HttpMasterViewModel.cs │ │ ├── EntityFrameworkDetailViewModel.cs │ │ └── EntityFrameworkMasterViewModel.cs │ └── tests │ └── unit │ └── Diol.Tests.Units │ ├── Diol.Tests.Units.csproj │ └── SqlQueryParserTest.cs ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── main_build.yml │ ├── main_vsix_release.yml │ └── main_diolbackendservice_release.yml ├── SECURITY.md ├── LICENSE ├── CONTRIBUTING.md ├── README.md └── Promotions └── 1_DiolReleased.md /content/screenshots/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dotnet-IO-logger/core/HEAD/content/screenshots/main.png -------------------------------------------------------------------------------- /content/images/diol-main-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dotnet-IO-logger/core/HEAD/content/images/diol-main-banner.png -------------------------------------------------------------------------------- /content/images/diol-main-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dotnet-IO-logger/core/HEAD/content/images/diol-main-image.png -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/Resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dotnet-IO-logger/core/HEAD/source/Diol/src/applications/DiolVSIX/Resources/logo.png -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/Resources/DiolCommandLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dotnet-IO-logger/core/HEAD/source/Diol/src/applications/DiolVSIX/Resources/DiolCommandLogo.png -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/Resources/DiolToolWindowCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dotnet-IO-logger/core/HEAD/source/Diol/src/applications/DiolVSIX/Resources/DiolToolWindowCommand.png -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Diol.Share.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | AnyCPU;x86 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Aspnet/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace Diol.Aspnet.Pages 5 | { 6 | public class IndexModel : PageModel 7 | { 8 | public void OnGet() 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "DiolBackendService": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "environmentVariables": { 7 | "DOTNET_ENVIRONMENT": "Development" 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace DiolBackendService.Pages 5 | { 6 | public class IndexModel : PageModel 7 | { 8 | public void OnGet() 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Consumers/IConsumer.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features; 2 | using System; 3 | 4 | namespace Diol.Share.Consumers 5 | { 6 | /// 7 | /// Represents a consumer that observes and consumes objects. 8 | /// 9 | public interface IConsumer : IObserver 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/Program.cs: -------------------------------------------------------------------------------- 1 | using Diol.Aspnet; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | 5 | builder.Services.AddRazorPages(); 6 | 7 | builder.Services.AddDiolWeb(); 8 | builder.Services.AddRazorPages(); 9 | 10 | var app = builder.Build(); 11 | 12 | app.MapRazorPages(); 13 | app.UseDiol(); 14 | 15 | app.Run(); 16 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | }, 7 | "EventLog": { 8 | "LogLevel": { 9 | "Default": "Information", 10 | "Microsoft.Hosting.Lifetime": "Information" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.WpfClient/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/publishManifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/vsix-publish", 3 | "categories": ["Coding", "Other", "Testing"], 4 | "identity": { 5 | "internalName": "Diol" 6 | }, 7 | "overview": "Readme.md", 8 | "priceCategory": "free", 9 | "publisher": "Diol-devs", 10 | "private": false, 11 | "qna": true, 12 | "repo": "https://github.com/Dotnet-IO-logger/core" 13 | } -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Utils/DotnetProcessInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Diol.Share.Utils 2 | { 3 | /// 4 | /// Represents information about a dotnet process. 5 | /// 6 | public class DotnetProcessInfo 7 | { 8 | /// 9 | /// Gets or sets the ID of the dotnet process. 10 | /// 11 | public int Id { get; set; } 12 | 13 | /// 14 | /// Gets or sets the name of the dotnet process. 15 | /// 16 | public string Name { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/Diol.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Services/IApplicationStateService.cs: -------------------------------------------------------------------------------- 1 | namespace Diol.Share.Services 2 | { 3 | /// 4 | /// Represents an interface for subscribing to application state changes. 5 | /// 6 | public interface IApplicationStateService 7 | { 8 | /// 9 | /// Subscribes to application state changes. 10 | /// 11 | void Subscribe(); 12 | } 13 | 14 | public class LocalApplicationStateService : IApplicationStateService 15 | { 16 | /// 17 | public void Subscribe() 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/DiolToolWindowControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace DiolVSIX 6 | { 7 | /// 8 | /// Interaction logic for DiolToolWindowControl. 9 | /// 10 | public partial class DiolToolWindowControl : UserControl 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DiolToolWindowControl() 16 | { 17 | this.InitializeComponent(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.WpfClient/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Diol.Wpf.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net462 5 | true 6 | AnyCPU;x86 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Aspnet/Diol.Aspnet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Https/HttpEvents.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace Diol.Wpf.Core.Features.Https 4 | { 5 | /// 6 | /// Event raised when an HTTP request is started. 7 | /// 8 | public class HttpRequestStartedEvent : PubSubEvent 9 | { 10 | } 11 | 12 | /// 13 | /// Event raised when an HTTP request is ended. 14 | /// 15 | public class HttpRequestEndedEvent : PubSubEvent 16 | { 17 | } 18 | 19 | /// 20 | /// Event raised when an HTTP item is selected. 21 | /// 22 | public class HttpItemSelectedEvent : PubSubEvent 23 | { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/ReadME.md: -------------------------------------------------------------------------------- 1 | # DiolBackendService 2 | 3 | ## How to install 4 | 5 | 1. Open a `setupAsDotnetTool.ps1` script 6 | 2. Just run step by step the commands in the script 7 | 8 | ### I want to update the version 9 | 10 | In this case please just uninstall the previous version (the command you can find the the ps1 script) and then install the new version (the command you can find in the ps1 script) 11 | 12 | ```powershell 13 | 14 | ## How to use 15 | 16 | After installation you can run the following command to start the server: 17 | 18 | ```powershell 19 | DiolBackendService --urls=http://localhost:62023/ 20 | ``` 21 | 22 | `---urls` can be changed to any port you want to run the server on. -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/EntityFrameworks/CommandExecutedDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Diol.Share.Features.EntityFrameworks 4 | { 5 | /// 6 | /// Represents a data transfer object for a command executed event in Entity Framework. 7 | /// 8 | public class CommandExecutedDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "EntityFramework"; 12 | 13 | /// 14 | public override string EventName => nameof(CommandExecutedDto); 15 | 16 | /// 17 | /// Gets or sets the elapsed time in milliseconds for the command execution. 18 | /// 19 | public TimeSpan ElapsedMilliseconds { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Httpclients/RequestPipelineResponseHeaderDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Httpclients 4 | { 5 | /// 6 | /// Represents the response header data for the request pipeline. 7 | /// 8 | public class RequestPipelineResponseHeaderDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "HttpClient"; 12 | 13 | /// 14 | public override string EventName => nameof(RequestPipelineResponseHeaderDto); 15 | 16 | /// 17 | /// Gets or sets the dictionary of headers. 18 | /// 19 | public Dictionary Headers { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Httpclients/RequestPipelineRequestHeaderDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Httpclients 4 | { 5 | /// 6 | /// Represents the data transfer object for the request headers in the request pipeline. 7 | /// 8 | public class RequestPipelineRequestHeaderDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "HttpClient"; 12 | 13 | /// 14 | public override string EventName => nameof(RequestPipelineRequestHeaderDto); 15 | 16 | /// 17 | /// Gets or sets the dictionary of headers. 18 | /// 19 | public Dictionary Headers { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Aspnetcores/AspnetEvents.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace Diol.Wpf.Core.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents an event that is raised when an ASP.NET request starts. 7 | /// 8 | public class AspnetRequestStartedEvent : PubSubEvent 9 | { 10 | } 11 | 12 | /// 13 | /// Represents an event that is raised when an ASP.NET request ends. 14 | /// 15 | public class AspnetRequestEndedEvent : PubSubEvent 16 | { 17 | } 18 | 19 | /// 20 | /// Represents an event that is raised when an item is selected in ASP.NET. 21 | /// 22 | public class AspnetItemSelectedEvent : PubSubEvent 23 | { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.WpfClient/Diol.applications.WpfClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | enable 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/HttpMaster.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for HttpMaster.xaml 20 | /// 21 | public partial class HttpMaster : UserControl 22 | { 23 | public HttpMaster() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/AspnetMaster.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for AspnetMaster.xaml 20 | /// 21 | public partial class AspnetMaster : UserControl 22 | { 23 | public AspnetMaster() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/MainComponent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for MainView.xaml 20 | /// 21 | public partial class MainComponent : UserControl 22 | { 23 | public MainComponent() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/DiolComponent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for DiolComponent.xaml 20 | /// 21 | public partial class DiolComponent : UserControl 22 | { 23 | public DiolComponent() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/AspnetComponent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for AspnetMasterDetail.xaml 20 | /// 21 | public partial class AspnetComponent : UserControl 22 | { 23 | public AspnetComponent() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/DiagnosticsView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for DiagnosticsView.xaml 20 | /// 21 | public partial class DiagnosticsView : UserControl 22 | { 23 | public DiagnosticsView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/HttpComponent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for HttpMasterDetailView.xaml 20 | /// 21 | public partial class HttpComponent : UserControl 22 | { 23 | public HttpComponent() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/WelcomeComponent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for WelcomeComponent.xaml 20 | /// 21 | public partial class WelcomeComponent : UserControl 22 | { 23 | public WelcomeComponent() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/EntityFrameworkDetail.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for EntityFrameworkDetail.xaml 20 | /// 21 | public partial class EntityFrameworkDetail : UserControl 22 | { 23 | public EntityFrameworkDetail() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/EntityFrameworkMaster.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for EntityFrameworkMaster.xaml 20 | /// 21 | public partial class EntityFrameworkMaster : UserControl 22 | { 23 | public EntityFrameworkMaster() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/EntityFrameworkComponent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Diol.Wpf.Core.Views 17 | { 18 | /// 19 | /// Interaction logic for EntityFrameworkComponent.xaml 20 | /// 21 | public partial class EntityFrameworkComponent : UserControl 22 | { 23 | public EntityFrameworkComponent() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/DiolComponent.xaml: -------------------------------------------------------------------------------- 1 | 13 | 15 | 16 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.ConsoleClient/Diol.applications.ConsoleClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/setup.ps1: -------------------------------------------------------------------------------- 1 | # if you want to use the tool from nuget feed: 2 | dotnet nuget add source --username [GithubUserName] --password [YourApiKey] --name github-diol https://nuget.pkg.github.com/Dotnet-IO-logger/index.json 3 | dotnet tool install -g DiolBackendService 4 | 5 | # if you want to install it locally 6 | $packageName = 'DiolBackendService' 7 | $packagePath = '.\distrib\release\DiolBackendService' 8 | 9 | $csProjPath = '.\DiolBackendService.csproj' 10 | 11 | # delete old one 12 | dotnet tool uninstall -g $packageName 13 | 14 | # pack and install 15 | dotnet build -c Release 16 | dotnet pack $csProjPath --output $packagePath 17 | dotnet tool install --global --add-source $packagePath $packageName 18 | 19 | # how to use 20 | # from a terminal please run the following command: 21 | # DiolBackendService --urls=http://localhost:62023/ -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/EntityFrameworks/ConnectionOpeningDto.cs: -------------------------------------------------------------------------------- 1 | namespace Diol.Share.Features.EntityFrameworks 2 | { 3 | /// 4 | /// Represents a data transfer object for opening a connection in Entity Framework. 5 | /// 6 | public class ConnectionOpeningDto : BaseDto 7 | { 8 | /// 9 | public override string CategoryName => "EntityFramework"; 10 | 11 | /// 12 | public override string EventName => nameof(ConnectionOpeningDto); 13 | 14 | /// 15 | /// Gets or sets the name of the database. 16 | /// 17 | public string Database { get; set; } 18 | 19 | /// 20 | /// Gets or sets the name of the server. 21 | /// 22 | public string Server { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Aspnetcores/RequestBodyDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents the request body data transfer object. 7 | /// 8 | public class RequestBodyDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "AspnetCore"; 12 | 13 | /// 14 | public override string EventName => nameof(RequestBodyDto); 15 | 16 | /// 17 | /// Gets or sets the body as a string. 18 | /// 19 | public string BodyAsString { get; set; } 20 | 21 | /// 22 | /// Gets or sets the metadata dictionary. 23 | /// 24 | public Dictionary Metadata { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Aspnetcores/ResponseBodyDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents the response body data transfer object. 7 | /// 8 | public class ResponseBodyDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "AspnetCore"; 12 | 13 | /// 14 | public override string EventName => nameof(ResponseBodyDto); 15 | 16 | /// 17 | /// Gets or sets the body as a string. 18 | /// 19 | public string BodyAsString { get; set; } 20 | 21 | /// 22 | /// Gets or sets the metadata dictionary. 23 | /// 24 | public Dictionary Metadata { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/Services/VsProcessProvider.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Services; 2 | using EnvDTE80; 3 | 4 | namespace DiolVSIX.Services 5 | { 6 | public class VsProcessProvider : IProcessProvider 7 | { 8 | private readonly DTE2 dte; 9 | 10 | public VsProcessProvider(DTE2 dte) 11 | { 12 | this.dte = dte; 13 | } 14 | 15 | public int? GetProcessId() 16 | { 17 | int? result = null; 18 | 19 | if (dte.Debugger?.DebuggedProcesses?.Count > 0) 20 | { 21 | foreach (EnvDTE.Process process in this.dte.Debugger.DebuggedProcesses) 22 | { 23 | result = process.ProcessID; 24 | break; 25 | } 26 | 27 | return result; 28 | } 29 | 30 | return result; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Httpclients/RequestPipelineEndDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Diol.Share.Features.Httpclients 4 | { 5 | /// 6 | /// Represents the data transfer object for the end of a request pipeline. 7 | /// 8 | public class RequestPipelineEndDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "HttpClient"; 12 | 13 | /// 14 | public override string EventName => nameof(RequestPipelineEndDto); 15 | 16 | /// 17 | /// Gets or sets the status code of the request. 18 | /// 19 | public int StatusCode { get; set; } 20 | 21 | /// 22 | /// Gets or sets the elapsed time in milliseconds for the request. 23 | /// 24 | public TimeSpan ElapsedMilliseconds { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.ConsoleClient/ConsoleConsumer.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Consumers; 2 | using Diol.Share.Features; 3 | using System.Diagnostics; 4 | using System.Text.Json; 5 | 6 | namespace Diol.applications.ConsoleClient 7 | { 8 | public class ConsoleConsumer : IConsumer 9 | { 10 | public void OnCompleted() 11 | { 12 | // IObservable has finished. 13 | Debug.WriteLine($"{nameof(ConsoleConsumer)} | {nameof(OnCompleted)}"); 14 | } 15 | 16 | public void OnError(Exception error) 17 | { 18 | // write log 19 | Debug.WriteLine($"{nameof(ConsoleConsumer)} | {nameof(OnError)}"); 20 | } 21 | 22 | public void OnNext(BaseDto value) 23 | { 24 | Console.WriteLine(); 25 | Console.WriteLine(JsonSerializer.Serialize(value, value.GetType())); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/tests/unit/Diol.Tests.Units/Diol.Tests.Units.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Services/RelayCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace Diol.Wpf.Core.Services 5 | { 6 | public class RelayCommand : ICommand 7 | { 8 | private readonly Action _execute; 9 | private readonly Func _canExecute; 10 | 11 | public RelayCommand(Action execute, Func canExecute = null) 12 | { 13 | _execute = execute ?? throw new ArgumentNullException(nameof(execute)); 14 | _canExecute = canExecute; 15 | } 16 | 17 | public bool CanExecute(object parameter) => _canExecute?.Invoke(parameter) ?? true; 18 | 19 | public void Execute(object parameter) => _execute(parameter); 20 | 21 | public event EventHandler CanExecuteChanged 22 | { 23 | add => CommandManager.RequerySuggested += value; 24 | remove => CommandManager.RequerySuggested -= value; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Services/DiolBuilder.cs: -------------------------------------------------------------------------------- 1 | using Diol.Core.DiagnosticClients; 2 | 3 | namespace Diol.Wpf.Core.Services 4 | { 5 | /// 6 | /// Represents a builder for creating Diol event sources. 7 | /// 8 | public class DiolBuilder 9 | { 10 | private readonly EventPipeEventSourceBuilder builder; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The event source builder. 16 | public DiolBuilder(EventPipeEventSourceBuilder builder) 17 | { 18 | this.builder = builder; 19 | } 20 | 21 | /// 22 | /// Gets the event source builder. 23 | /// 24 | /// The event source builder. 25 | public EventPipeEventSourceBuilder GetBuilder() 26 | { 27 | return this.builder; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/BaseDto.cs: -------------------------------------------------------------------------------- 1 | namespace Diol.Share.Features 2 | { 3 | /// 4 | /// Base class for Data Transfer Objects (DTOs). 5 | /// 6 | public abstract class BaseDto 7 | { 8 | /// 9 | /// Gets or sets the correlation ID. 10 | /// 11 | public string CorrelationId { get; set; } 12 | 13 | /// 14 | /// Gets the category name. 15 | /// 16 | public abstract string CategoryName { get; } 17 | 18 | /// 19 | /// Gets the event name. 20 | /// 21 | public abstract string EventName { get; } 22 | 23 | /// 24 | /// Gets or sets the process ID. 25 | /// 26 | public int ProcessId { get; set; } 27 | 28 | /// 29 | /// Gets or sets the process name. 30 | /// 31 | public string ProcessName { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/EntityFrameworks/EntityFrameworkModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features.EntityFrameworks; 2 | 3 | namespace Diol.Wpf.Core.Features.EntityFrameworks 4 | { 5 | /// 6 | /// Represents the Entity Framework model. 7 | /// 8 | public class EntityFrameworkModel 9 | { 10 | /// 11 | /// Gets or sets the key of the model. 12 | /// 13 | public string Key { get; set; } 14 | 15 | /// 16 | /// Gets or sets the connection opening DTO. 17 | /// 18 | public ConnectionOpeningDto ConnectionOpening { get; set; } 19 | 20 | /// 21 | /// Gets or sets the command executing DTO. 22 | /// 23 | public CommandExecutingDto CommandExecuting { get; set; } 24 | 25 | /// 26 | /// Gets or sets the command executed DTO. 27 | /// 28 | public CommandExecutedDto CommandExecuted { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Aspnetcores/ResponseLogDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents a data transfer object for logging response information. 7 | /// 8 | public class ResponseLogDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "AspnetCore"; 12 | 13 | /// 14 | public override string EventName => nameof(ResponseLogDto); 15 | 16 | /// 17 | /// Gets or sets the status code of the response. 18 | /// 19 | public int StatusCode { get; set; } 20 | 21 | /// 22 | /// Gets or sets the content type of the response. 23 | /// 24 | public string ContentType { get; set; } 25 | 26 | /// 27 | /// Gets or sets the metadata associated with the response. 28 | /// 29 | public Dictionary Metadata { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Httpclients/RequestPipelineStartDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Httpclients 4 | { 5 | /// 6 | /// Represents the data transfer object for the start of a request pipeline. 7 | /// 8 | public class RequestPipelineStartDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "HttpClient"; 12 | 13 | /// 14 | public override string EventName => nameof(RequestPipelineStartDto); 15 | 16 | /// 17 | /// Gets or sets the HTTP method of the request. 18 | /// 19 | public string HttpMethod { get; set; } 20 | 21 | /// 22 | /// Gets or sets the URI of the request. 23 | /// 24 | public string Uri { get; set; } 25 | 26 | /// 27 | /// Gets or sets the dictionary of query parameters. 28 | /// 29 | public Dictionary QueryParameters { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/main_build.yml: -------------------------------------------------------------------------------- 1 | name: main_build 2 | 3 | on: 4 | pull_request: 5 | branches: [ main ] 6 | paths: 7 | - 'source/**' 8 | 9 | env: 10 | SOLUTION_PATH: source/Diol/Diol.sln 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: windows-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | 20 | - name: Setup MSBuild 21 | uses: microsoft/setup-msbuild@v2 22 | 23 | - name: Restore NuGet packages 24 | run: msbuild /t:restore ${{ env.SOLUTION_PATH }} 25 | 26 | - name: Build 27 | run: msbuild /p:Configuration=Release /p:Platform="Any CPU" ${{ env.SOLUTION_PATH }} 28 | 29 | - uses: actions/setup-dotnet@v4 30 | with: 31 | dotnet-version: 8.0.x 32 | 33 | - name: Test 34 | run: dotnet test --no-restore --verbosity normal --logger trx --results-directory TestResults ${{ env.SOLUTION_PATH }} 35 | 36 | - name: Test Report 37 | uses: dorny/test-reporter@v1 38 | if: always() 39 | with: 40 | name: Test Results 41 | path: TestResults/*.trx 42 | reporter: dotnet-trx -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/EntityFrameworks/EntityFrameworkEvents.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace Diol.Wpf.Core.Features.EntityFrameworks 4 | { 5 | /// 6 | /// Represents an event that is raised when an Entity Framework connection is started. 7 | /// 8 | public class EntityFrameworkConnectionStartedEvent : PubSubEvent 9 | { 10 | } 11 | 12 | /// 13 | /// Represents an event that is raised when an Entity Framework connection is started. 14 | /// 15 | public class EntityFrameworkQueryExecutingEvent : PubSubEvent 16 | { 17 | } 18 | 19 | /// 20 | /// Represents an event that is raised when an Entity Framework connection is ended. 21 | /// 22 | public class EntityFrameworkConnectionEndedEvent : PubSubEvent 23 | { 24 | } 25 | 26 | /// 27 | /// Represents an event that is raised when an item is selected in Entity Framework. 28 | /// 29 | public class EntityFrameworkItemSelectedEvent : PubSubEvent 30 | { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Aspnetcores/AspnetcoreModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features.Aspnetcores; 2 | 3 | namespace Diol.Wpf.Core.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents an ASP.NET Core model. 7 | /// 8 | public class AspnetcoreModel 9 | { 10 | /// 11 | /// Gets or sets the key. 12 | /// 13 | public string Key { get; set; } 14 | 15 | /// 16 | /// Gets or sets the request log. 17 | /// 18 | public RequestLogDto Request { get; set; } 19 | 20 | /// 21 | /// Gets or sets the request body metadata. 22 | /// 23 | public RequestBodyDto RequestMetadata { get; set; } 24 | 25 | /// 26 | /// Gets or sets the response log. 27 | /// 28 | public ResponseLogDto Response { get; set; } 29 | 30 | /// 31 | /// Gets or sets the response body metadata. 32 | /// 33 | public ResponseBodyDto ResponseMetadata { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Https/HttpModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features.Httpclients; 2 | 3 | namespace Diol.Wpf.Core.Features.Https 4 | { 5 | /// 6 | /// Represents an HTTP model. 7 | /// 8 | public class HttpModel 9 | { 10 | /// 11 | /// Gets or sets the key. 12 | /// 13 | public string Key { get; set; } 14 | 15 | /// 16 | /// Gets or sets the request. 17 | /// 18 | public RequestPipelineStartDto Request { get; set; } 19 | 20 | /// 21 | /// Gets or sets the request metadata. 22 | /// 23 | public RequestPipelineRequestHeaderDto RequestMetadata { get; set; } 24 | 25 | /// 26 | /// Gets or sets the response. 27 | /// 28 | public RequestPipelineEndDto Response { get; set; } 29 | 30 | /// 31 | /// Gets or sets the response metadata. 32 | /// 33 | public RequestPipelineResponseHeaderDto ResponseMetadata { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Dotnet IO logger extension Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/main_vsix_release.yml: -------------------------------------------------------------------------------- 1 | name: main_vsix_release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | env: 7 | SOLUTION_PATH: source/Diol/Diol.sln 8 | VSIX_PROJECT_PATH: source/Diol/src/applications/DiolVSIX/DiolVSIX.csproj 9 | VSIX_OUTPUT_PATH: distr/diol 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: windows-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Setup MSBuild 20 | uses: microsoft/setup-msbuild@v2 21 | 22 | - name: Restore NuGet packages 23 | run: msbuild /t:restore ${{ env.SOLUTION_PATH }} 24 | 25 | - name: Build 26 | run: msbuild /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=${{ github.workspace }}/${{ env.VSIX_OUTPUT_PATH }} ${{ env.VSIX_PROJECT_PATH }} 27 | 28 | - name: Publish extension to Marketplace 29 | uses: cezarypiatek/VsixPublisherAction@1.1 30 | with: 31 | extension-file: ${{ github.workspace }}/${{ env.VSIX_OUTPUT_PATH }}/DiolVSIX.vsix 32 | publish-manifest-file: ${{ github.workspace }}/${{ env.VSIX_OUTPUT_PATH }}/publishManifest.json 33 | personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/DiagnosticClients/EventPipeHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Diagnostics.NETCore.Client; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.Tracing; 4 | 5 | namespace Diol.Core.DiagnosticClients 6 | { 7 | /// 8 | /// Helper class for EventPipe functionality. 9 | /// 10 | public static class EventPipeHelper 11 | { 12 | /// 13 | /// Gets a collection of EventPipeProvider instances. 14 | /// 15 | /// 16 | /// A read-only collection of EventPipeProvider instances. 17 | /// 18 | public static IReadOnlyCollection Providers => 19 | new List() 20 | { 21 | new EventPipeProvider( 22 | "Microsoft-Extensions-Logging", 23 | EventLevel.LogAlways, 24 | 263882790666248), 25 | new EventPipeProvider( 26 | "System.Threading.Tasks.TplEventSource", 27 | EventLevel.LogAlways, 28 | 0x80) 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/TraceEventProcessors/EventPublisherUnsubscriber.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Diol.Core.TraceEventProcessors 6 | { 7 | /// 8 | /// Represents a class that unsubscribes observers from an event publisher. 9 | /// 10 | public class EventPublisherUnSubscriber : IDisposable 11 | { 12 | private List> observers; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The list of observers to unsubscribe. 18 | public EventPublisherUnSubscriber(List> observers) 19 | { 20 | this.observers = observers; 21 | } 22 | 23 | /// 24 | /// Disposes the instance and clears the list of observers. 25 | /// 26 | public void Dispose() 27 | { 28 | if (observers != null) 29 | { 30 | this.observers.Clear(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/TraceEventProcessors/TraceEventRouterUnsubscriber.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Diagnostics.Tracing; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Diol.Core.TraceEventProcessors 6 | { 7 | /// 8 | /// Represents a class that unsubscribes observers from a trace event router. 9 | /// 10 | public class TraceEventRouterUnSubscriber : IDisposable 11 | { 12 | private List> observers; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The list of observers to unsubscribe. 18 | public TraceEventRouterUnSubscriber(List> observers) 19 | { 20 | this.observers = observers; 21 | } 22 | 23 | /// 24 | /// Disposes the instance. 25 | /// 26 | public void Dispose() 27 | { 28 | if(this.observers != null) 29 | { 30 | this.observers.Clear(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.github/workflows/main_diolbackendservice_release.yml: -------------------------------------------------------------------------------- 1 | name: Main DiolBackendService Release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | env: 7 | CSPROJ_PATH: 'source/Diol/src/applications/DiolBackendService/DiolBackendService.csproj' 8 | NUPKGNAME: 'DiolBackendService' 9 | DISTR_PATH: ${{ github.workspace }}\distr 10 | 11 | jobs: 12 | build: 13 | runs-on: windows-latest 14 | 15 | steps: 16 | - name: Checkout code 17 | uses: actions/checkout@v2 18 | 19 | - name: Setup .NET 20 | uses: actions/setup-dotnet@v1 21 | with: 22 | dotnet-version: '8.0.x' 23 | 24 | - name: Build 25 | run: dotnet build ${{ env.CSPROJ_PATH }} --configuration Release 26 | 27 | - name: Pack 28 | run: | 29 | dotnet pack ${{ env.CSPROJ_PATH }} --configuration Release --output ${{ env.DISTR_PATH }} 30 | ls ${{ env.DISTR_PATH }} 31 | 32 | - name: Push 33 | run: | 34 | dotnet nuget add source https://nuget.pkg.github.com/Dotnet-IO-logger/index.json --name github --username Dotnet-IO-logger --password ${{ secrets.GITHUB_TOKEN }} 35 | dotnet nuget push "${{ env.DISTR_PATH }}\*.nupkg" --source "https://nuget.pkg.github.com/Dotnet-IO-logger/index.json" 36 | 37 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/TraceEventProcessors/IProcessor.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features; 2 | using Microsoft.Diagnostics.Tracing; 3 | using System; 4 | 5 | namespace Diol.Core.TraceEventProcessors 6 | { 7 | /// 8 | /// Represents a processor for handling trace events. 9 | /// 10 | public interface IProcessor : IObserver 11 | { 12 | /// 13 | /// Checks if the specified event should be processed by the processor. 14 | /// 15 | /// The name of the logger. 16 | /// The name of the event. 17 | /// true if the event should be processed; otherwise, false. 18 | bool CheckEvent(string loggerName, string eventName); 19 | 20 | /// 21 | /// Gets the log data transfer object (DTO) for the specified event. 22 | /// 23 | /// The ID of the event. 24 | /// The trace event. 25 | /// The log data transfer object (DTO) for the event. 26 | BaseDto GetLogDto(int eventId, TraceEvent value); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/MainModule.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Services; 2 | using Prism.Ioc; 3 | using Prism.Modularity; 4 | using Prism.Regions; 5 | 6 | namespace Diol.Wpf.Core 7 | { 8 | /// 9 | /// Represents the main module of the application. 10 | /// 11 | public class MainModule : IModule 12 | { 13 | /// 14 | /// Initializes the module. 15 | /// 16 | /// The container provider. 17 | public void OnInitialized(IContainerProvider containerProvider) 18 | { 19 | var regionManager = containerProvider.Resolve(); 20 | regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.MainComponent)); 21 | } 22 | 23 | /// 24 | /// Registers types in the container. 25 | /// 26 | /// The container registry. 27 | public void RegisterTypes(IContainerRegistry containerRegistry) 28 | { 29 | containerRegistry.RegisterForNavigation(); 30 | containerRegistry.RegisterForNavigation(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.WpfClient/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Services; 2 | using Diol.Wpf.Core; 3 | using Diol.Wpf.Core.Services; 4 | using Diol.Wpf.Core.Views; 5 | using Prism.Ioc; 6 | using Prism.Modularity; 7 | using Prism.Unity; 8 | using System.Windows; 9 | 10 | namespace Diol.applications.WpfClient 11 | { 12 | /// 13 | /// Interaction logic for App.xaml 14 | /// 15 | public partial class App : PrismApplication 16 | { 17 | protected override Window CreateShell() 18 | { 19 | var w = Container.Resolve(); 20 | return w; 21 | } 22 | 23 | protected override void RegisterTypes(IContainerRegistry containerRegistry) 24 | { 25 | // register all services here 26 | containerRegistry.AddDiolWpf< 27 | WpfConsumer, 28 | LocalDevelopmentProcessProvider, 29 | LocalApplicationStateService>(); 30 | } 31 | 32 | protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) 33 | { 34 | base.ConfigureModuleCatalog(moduleCatalog); 35 | moduleCatalog.AddModule(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/Diol/src/applications/Diol.applications.ConsoleClient/Program.cs: -------------------------------------------------------------------------------- 1 | using Diol.applications.ConsoleClient; 2 | using Diol.Core; 3 | using Diol.Core.DiagnosticClients; 4 | using Diol.Share.Services; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | Console.WriteLine("Welcome to Diol Console client"); 8 | 9 | // register services 10 | Console.WriteLine("Registering services"); 11 | var serviceCollection = new ServiceCollection(); 12 | serviceCollection.AddDiolCore(); 15 | 16 | var services = serviceCollection.BuildServiceProvider(); 17 | 18 | // run app 19 | Console.WriteLine("Running app"); 20 | 21 | // get process 22 | var dotnetProcessesService = services.GetRequiredService(); 23 | var builder = services.GetRequiredService(); 24 | 25 | var processId = dotnetProcessesService.GetProcessId(); 26 | 27 | if (processId == null) 28 | { 29 | Console.WriteLine($"Process not found. Please try again"); 30 | return; 31 | } 32 | 33 | // run process 34 | var eventPipeEventSourceWrapper = builder 35 | .SetProcessId(processId.Value) 36 | .Build(); 37 | 38 | eventPipeEventSourceWrapper.Start(); 39 | 40 | Console.ReadKey(); -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Thank you for your interest in contributing to our dotnet open source project. 2 | 3 | We welcome and appreciate any help from the community. 4 | 5 | To make your contribution easier and more effective, please follow these steps: 6 | 7 | 1. Create an issue ticket on our GitHub repository. Describe the problem you want to solve or the feature you want to add. Make sure there is no duplicate or similar issue already open. 8 | 2. Explain your proposed solution or idea in detail. Provide any relevant information, such as code snippets, screenshots, links, etc. If possible, also include a test case or a scenario that demonstrates the expected behavior. 9 | 3. Fork our repository and create a new branch for your changes. Name your branch according to the issue number and a short description, such as `issue-123-fix-bug` or `issue-456-add-feature`. 10 | 4. Add your changes to the branch. Follow the coding style and conventions of our project. Write clear and concise commit messages that explain what and why you changed. 11 | 5. Make a pull request (PR) from your branch to our master branch. Reference the issue number in the PR title or description, such as `Fixes #123` or `Closes #456`. Wait for our review and feedback. Be ready to make any changes or improvements if requested. 12 | 13 | *Created by Bing Chat AI* 14 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/EntityFrameworks/CommandExecutingDto.cs: -------------------------------------------------------------------------------- 1 | namespace Diol.Share.Features.EntityFrameworks 2 | { 3 | /// 4 | /// Represents a data transfer object for executing commands in Entity Framework. 5 | /// 6 | public class CommandExecutingDto : BaseDto 7 | { 8 | /// 9 | /// Gets or sets the parameters for the command. 10 | /// 11 | public string Parameters { get; set; } 12 | 13 | /// 14 | /// Gets or sets the text of the command. 15 | /// 16 | public string CommandText { get; set; } 17 | 18 | /// 19 | /// Gets or sets the Operation Name. 20 | /// 21 | public string OperationName { get; set; } 22 | 23 | /// 24 | /// Gets or sets the Table Name. 25 | /// 26 | public string TableName { get; set; } 27 | 28 | /// 29 | public override string CategoryName => "EntityFramework"; 30 | 31 | /// 32 | public override string EventName => nameof(CommandExecutingDto); 33 | 34 | /// 35 | /// Flag is the query is a part of a transaction. 36 | /// 37 | public bool IsTransaction { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolBackendService/DiolBackendService.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | true 9 | true 10 | DiolBackendService 11 | DiolBackendService 12 | 1.21.2 13 | Diol devs 14 | Diol devs 15 | DiolBackendService provides DIOL logic without UX 16 | https://github.com/Dotnet-IO-logger/core 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | PreserveNewest 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/HttpComponent.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Services/IProcessProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace Diol.Share.Services 4 | { 5 | /// 6 | /// Represents a provider for retrieving process information. 7 | /// 8 | public interface IProcessProvider 9 | { 10 | /// 11 | /// Gets the process ID. 12 | /// 13 | /// The process ID, or null if the process is not found. 14 | int? GetProcessId(); 15 | } 16 | 17 | public class LocalDevelopmentProcessProvider : IProcessProvider 18 | { 19 | private readonly DotnetProcessesService dotnetService; 20 | 21 | public LocalDevelopmentProcessProvider(DotnetProcessesService dotnetService) 22 | { 23 | this.dotnetService = dotnetService; 24 | } 25 | 26 | /// 27 | public int? GetProcessId() 28 | { 29 | // we expect that the process is running (Diol.Playgrounds.PlaygroundApi.exe) 30 | var processName = "Diol.Playgrounds.PlaygroundApi"; 31 | var process = this.dotnetService.GetItemOrDefault(processName); 32 | 33 | if (process == null) 34 | { 35 | Debug.WriteLine($"Process {processName} not found. Please try again"); 36 | } 37 | 38 | return process?.Id; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/AspnetComponent.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/EntityFrameworkComponent.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DiolVSIX")] 9 | [assembly: AssemblyDescription("Diol is Dotnet Input Output Logger.")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DiolVSIX")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/HttpDetail.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Input; 4 | using System.Windows.Media; 5 | 6 | namespace Diol.Wpf.Core.Views 7 | { 8 | /// 9 | /// Interaction logic for HttpDetail.xaml 10 | /// 11 | public partial class HttpDetail : UserControl 12 | { 13 | public HttpDetail() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void DataGrid_PreviewMouseWheel(object sender, MouseWheelEventArgs e) 19 | { 20 | var scrollViewer = FindParent((DependencyObject)sender); 21 | if (scrollViewer != null) 22 | { 23 | scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - e.Delta); 24 | e.Handled = true; 25 | } 26 | } 27 | 28 | private static T FindParent(DependencyObject child) where T : DependencyObject 29 | { 30 | DependencyObject parentObject = VisualTreeHelper.GetParent(child); 31 | if (parentObject == null) return null; 32 | 33 | T parent = parentObject as T; 34 | if (parent != null) 35 | { 36 | return parent; 37 | } 38 | else 39 | { 40 | return FindParent(parentObject); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/AspnetDetail.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Input; 4 | using System.Windows.Media; 5 | 6 | namespace Diol.Wpf.Core.Views 7 | { 8 | /// 9 | /// Interaction logic for AspnetDetail.xaml 10 | /// 11 | public partial class AspnetDetail : UserControl 12 | { 13 | public AspnetDetail() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void DataGrid_PreviewMouseWheel(object sender, MouseWheelEventArgs e) 19 | { 20 | var scrollViewer = FindParent((DependencyObject)sender); 21 | if (scrollViewer != null) 22 | { 23 | scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - e.Delta); 24 | e.Handled = true; 25 | } 26 | } 27 | 28 | private static T FindParent(DependencyObject child) where T : DependencyObject 29 | { 30 | DependencyObject parentObject = VisualTreeHelper.GetParent(child); 31 | if (parentObject == null) return null; 32 | 33 | T parent = parentObject as T; 34 | if (parent != null) 35 | { 36 | return parent; 37 | } 38 | else 39 | { 40 | return FindParent(parentObject); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/Services/VsApplicationStateService.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Services; 2 | using Diol.Wpf.Core.Features.Shared; 3 | using EnvDTE; 4 | using Microsoft.VisualStudio.Shell; 5 | using Prism.Events; 6 | using System; 7 | 8 | namespace DiolVSIX.Services 9 | { 10 | public class VsApplicationStateService : IApplicationStateService, IDisposable 11 | { 12 | private readonly DebuggerEvents debuggerEvents; 13 | private readonly IEventAggregator eventAggregator; 14 | 15 | public VsApplicationStateService( 16 | DebuggerEvents debuggerEvents, 17 | IEventAggregator eventAggregator) 18 | { 19 | this.debuggerEvents = debuggerEvents; 20 | this.eventAggregator = eventAggregator; 21 | } 22 | 23 | public void Subscribe() 24 | { 25 | ThreadHelper.ThrowIfNotOnUIThread(); 26 | this.debuggerEvents.OnEnterRunMode += DebuggerEvents_OnEnterRunMode1; 27 | } 28 | 29 | private void DebuggerEvents_OnEnterRunMode1(dbgEventReason reason) 30 | { 31 | if (reason == dbgEventReason.dbgEventReasonLaunchProgram) 32 | { 33 | this.eventAggregator.GetEvent().Publish(true); 34 | } 35 | } 36 | 37 | public void Dispose() 38 | { 39 | ThreadHelper.ThrowIfNotOnUIThread(); 40 | this.debuggerEvents.OnEnterRunMode -= DebuggerEvents_OnEnterRunMode1; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Aspnetcores/AspnetViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | 3 | namespace Diol.Wpf.Core.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents the view model for ASP.NET core features. 7 | /// 8 | public class AspnetViewModel : BindableBase 9 | { 10 | private string _key; 11 | 12 | /// 13 | /// Gets or sets the key. 14 | /// 15 | public string Key 16 | { 17 | get => this._key; 18 | set => SetProperty(ref this._key, value); 19 | } 20 | 21 | private string _method; 22 | 23 | /// 24 | /// Gets or sets the method. 25 | /// 26 | public string Method 27 | { 28 | get => this._method; 29 | set => SetProperty(ref this._method, value); 30 | } 31 | 32 | private string _uri; 33 | 34 | /// 35 | /// Gets or sets the URI. 36 | /// 37 | public string Uri 38 | { 39 | get => this._uri; 40 | set => SetProperty(ref this._uri, value); 41 | } 42 | 43 | private int? _responseStatusCode; 44 | 45 | /// 46 | /// Gets or sets the response status code. 47 | /// 48 | public int? ResponseStatusCode 49 | { 50 | get => this._responseStatusCode; 51 | set => SetProperty(ref this._responseStatusCode, value); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/ViewModels/DiagnosticsViewModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Wpf.Core.Features.Shared; 2 | using Prism.Events; 3 | using Prism.Mvvm; 4 | using System.Collections.ObjectModel; 5 | 6 | namespace Diol.Wpf.Core.ViewModels 7 | { 8 | /// 9 | /// Represents the view model for the diagnostics view. 10 | /// 11 | public class DiagnosticsViewModel : BindableBase 12 | { 13 | private readonly IEventAggregator eventAggregator; 14 | 15 | /// 16 | /// Gets the collection of diagnostic logs. 17 | /// 18 | public ObservableCollection Logs { get; private set; } = 19 | new ObservableCollection(); 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The event aggregator. 25 | public DiagnosticsViewModel(IEventAggregator eventAggregator) 26 | { 27 | this.eventAggregator = eventAggregator; 28 | 29 | this.eventAggregator 30 | .GetEvent() 31 | .Subscribe( 32 | (e) => this.Logs.Add(e), 33 | ThreadOption.UIThread); 34 | 35 | this.eventAggregator 36 | .GetEvent() 37 | .Subscribe( 38 | (e) => this.Logs.Clear(), 39 | ThreadOption.UIThread); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/TraceEventProcessors/EventPublisher.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Features; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Diol.Core.TraceEventProcessors 6 | { 7 | /// 8 | /// Represents an event publisher that notifies observers when a new event is added. 9 | /// 10 | public class EventPublisher : IObservable 11 | { 12 | private readonly List> observers = new List>(); 13 | 14 | /// 15 | /// Subscribes an observer to receive notifications when a new event is added. 16 | /// 17 | /// The observer to subscribe. 18 | /// An IDisposable object that can be used to unsubscribe the observer. 19 | public IDisposable Subscribe(IObserver observer) 20 | { 21 | if (!this.observers.Contains(observer)) 22 | { 23 | this.observers.Add(observer); 24 | } 25 | 26 | return new EventPublisherUnSubscriber(observers); 27 | } 28 | 29 | /// 30 | /// Adds a new event and notifies all observers. 31 | /// 32 | /// The event to add. 33 | public void AddEvent(BaseDto baseEvent) 34 | { 35 | // notify all observers 36 | foreach (var observer in this.observers) 37 | { 38 | observer.OnNext(baseEvent); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/Utils/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace Diol.Core.Utils 7 | { 8 | public static class Utilities 9 | { 10 | /// 11 | /// Tries to get the value associated with the specified key from the dictionary and removes the key-value pair if found. 12 | /// 13 | /// The type of the keys in the dictionary. 14 | /// The type of the values in the dictionary. 15 | /// The dictionary to perform the operation on. 16 | /// The key to look for in the dictionary. 17 | /// When this method returns, contains the value associated with the specified key if found; otherwise, the default value for the type of the value parameter. 18 | public static void TryGetValueAndRemove( 19 | this Dictionary dictionary, 20 | TKey key, 21 | out TValue value) 22 | { 23 | if (dictionary.TryGetValue(key, out value)) 24 | dictionary.Remove(key); 25 | } 26 | 27 | public static Dictionary GetQueryParams(string uriValue) 28 | { 29 | var uri = new Uri(uriValue); 30 | var queryParams = HttpUtility.ParseQueryString(uri.Query); 31 | var result = queryParams.AllKeys 32 | .ToDictionary(key => key, key => queryParams[key]); 33 | 34 | return result; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Services/DiolExecutor.cs: -------------------------------------------------------------------------------- 1 | using Diol.Wpf.Core.Features.Shared; 2 | using Prism.Events; 3 | 4 | namespace Diol.Wpf.Core.Services 5 | { 6 | /// 7 | /// Executes the Diol process. 8 | /// 9 | public class DiolExecutor 10 | { 11 | private readonly IEventAggregator eventAggregator; 12 | private readonly DiolBuilder builder; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The event aggregator. 18 | /// The Diol builder. 19 | public DiolExecutor( 20 | IEventAggregator eventAggregator, 21 | DiolBuilder builder) 22 | { 23 | this.eventAggregator = eventAggregator; 24 | this.builder = builder; 25 | } 26 | 27 | /// 28 | /// Starts the Diol processing. 29 | /// 30 | /// The process ID. 31 | public void StartProcessing(int processId) 32 | { 33 | var executor = this.builder.GetBuilder() 34 | .SetProcessId(processId) 35 | .Build(); 36 | 37 | // send event start processing 38 | this.eventAggregator 39 | .GetEvent() 40 | .Publish(processId); 41 | 42 | // do processing 43 | executor.Start(); 44 | 45 | // send event finish processing 46 | this.eventAggregator 47 | .GetEvent() 48 | .Publish(processId); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/DiagnosticsView.xaml: -------------------------------------------------------------------------------- 1 | 13 | 22 | 23 | 28 | 33 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/DiolToolWindow.cs: -------------------------------------------------------------------------------- 1 | using DiolVSIX.Services; 2 | using Microsoft.VisualStudio.Shell; 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace DiolVSIX 7 | { 8 | /// 9 | /// This class implements the tool window exposed by this package and hosts a user control. 10 | /// 11 | /// 12 | /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane, 13 | /// usually implemented by the package implementer. 14 | /// 15 | /// This class derives from the ToolWindowPane class provided from the MPF in order to use its 16 | /// implementation of the IVsUIElementPane interface. 17 | /// 18 | /// 19 | [Guid(WindowGuidString)] 20 | public class DiolToolWindow : ToolWindowPane 21 | { 22 | public const string WindowGuidString = "446919b1-4c51-4119-a6ea-6884faa68f06"; 23 | public const string Title = "Diol"; 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | public DiolToolWindow() : base(null) 29 | { 30 | //this.dte = dte; 31 | 32 | this.Caption = Title; 33 | 34 | // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, 35 | // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on 36 | // the object returned by the Content property. 37 | var toolWindowControl = new DiolToolWindowControl(); 38 | var diolBootstrapper = new DiolBootstrapper(toolWindowControl); 39 | 40 | this.Content = toolWindowControl; 41 | 42 | diolBootstrapper.Run(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Share/Features/Aspnetcores/RequestLogDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Diol.Share.Features.Aspnetcores 4 | { 5 | /// 6 | /// Represents a data transfer object for logging request information. 7 | /// 8 | public class RequestLogDto : BaseDto 9 | { 10 | /// 11 | public override string CategoryName => "AspnetCore"; 12 | 13 | /// 14 | public override string EventName => nameof(RequestLogDto); 15 | 16 | /// 17 | /// Gets or sets the URI of the request. 18 | /// 19 | public string Uri { get; set; } 20 | 21 | /// 22 | /// Gets or sets the protocol of the request. 23 | /// 24 | public string Protocol { get; set; } 25 | 26 | /// 27 | /// Gets or sets the HTTP method of the request. 28 | /// 29 | public string Method { get; set; } 30 | 31 | /// 32 | /// Gets or sets the scheme of the request. 33 | /// 34 | public string Scheme { get; set; } 35 | 36 | /// 37 | /// Gets or sets the host of the request. 38 | /// 39 | public string Host { get; set; } 40 | 41 | /// 42 | /// Gets or sets the path of the request. 43 | /// 44 | public string Path { get; set; } 45 | 46 | /// 47 | /// Gets or sets the metadata associated with the request. 48 | /// 49 | public Dictionary Metadata { get; set; } 50 | 51 | /// 52 | /// Gets or sets the dictionary of query parameters. 53 | /// 54 | public Dictionary QueryParameters { get; set; } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/ViewModels/HttpComponentViewModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Wpf.Core.Features.Https; 2 | using Prism.Events; 3 | using Prism.Mvvm; 4 | using System.Windows; 5 | 6 | namespace Diol.Wpf.Core.ViewModels 7 | { 8 | /// 9 | /// Represents the view model for the HTTP component. 10 | /// 11 | public class HttpComponentViewModel : BindableBase 12 | { 13 | private IEventAggregator eventAggregator; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The event aggregator. 19 | public HttpComponentViewModel(IEventAggregator eventAggregator) 20 | { 21 | this.eventAggregator = eventAggregator; 22 | 23 | // handle master detail 24 | this.eventAggregator 25 | .GetEvent() 26 | .Subscribe(HandleHttpItemSelectedEvent, ThreadOption.UIThread); 27 | } 28 | 29 | private GridLength _detailWidth = new GridLength(0, GridUnitType.Star); 30 | 31 | /// 32 | /// Gets or sets the width of the detail. 33 | /// 34 | public GridLength DetailWidth 35 | { 36 | get => this._detailWidth; 37 | set => SetProperty(ref this._detailWidth, value); 38 | } 39 | 40 | private void HandleHttpItemSelectedEvent(string obj) 41 | { 42 | if (string.IsNullOrEmpty(obj)) 43 | { 44 | // handle close 45 | this.DetailWidth = new GridLength(0, GridUnitType.Star); 46 | } 47 | else 48 | { 49 | // handle open 50 | this.DetailWidth = new GridLength(1, GridUnitType.Star); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/ViewModels/AspnetComponentViewModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Wpf.Core.Features.Aspnetcores; 2 | using Prism.Events; 3 | using Prism.Mvvm; 4 | using System.Windows; 5 | 6 | namespace Diol.Wpf.Core.ViewModels 7 | { 8 | /// 9 | /// View model for the ASP.NET component. 10 | /// 11 | public class AspnetComponentViewModel : BindableBase 12 | { 13 | private IEventAggregator eventAggregator; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The event aggregator. 19 | public AspnetComponentViewModel(IEventAggregator eventAggregator) 20 | { 21 | this.eventAggregator = eventAggregator; 22 | 23 | // handle master detail 24 | this.eventAggregator 25 | .GetEvent() 26 | .Subscribe(HandleAspnetItemSelectedEvent, ThreadOption.UIThread); 27 | } 28 | 29 | private GridLength _detailWidth = new GridLength(0, GridUnitType.Star); 30 | 31 | /// 32 | /// Gets or sets the width of the detail. 33 | /// 34 | public GridLength DetailWidth 35 | { 36 | get => this._detailWidth; 37 | set => SetProperty(ref this._detailWidth, value); 38 | } 39 | 40 | private void HandleAspnetItemSelectedEvent(string obj) 41 | { 42 | if (string.IsNullOrEmpty(obj)) 43 | { 44 | // handle close 45 | this.DetailWidth = new GridLength(0, GridUnitType.Star); 46 | } 47 | else 48 | { 49 | // handle open 50 | this.DetailWidth = new GridLength(1, GridUnitType.Star); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/DiolVSIXPackage1.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace DiolVSIX 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string guidDiolVSIXPackageString = "d85dc7d0-f6c3-4609-9b85-f9783d51c5e5"; 16 | public static Guid guidDiolVSIXPackage = new Guid(guidDiolVSIXPackageString); 17 | 18 | public const string guidDiolVSIXPackageCmdSetString = "2ea0aec1-d51a-4d4e-ae46-49c68767b8b1"; 19 | public static Guid guidDiolVSIXPackageCmdSet = new Guid(guidDiolVSIXPackageCmdSetString); 20 | 21 | public const string guidImagesString = "2dd12e27-238f-42f5-8abd-57280d31d00f"; 22 | public static Guid guidImages = new Guid(guidImagesString); 23 | 24 | public const string diolCommandLogosString = "8df56e6c-31d5-49a9-9c40-b34a85fd42b1"; 25 | public static Guid diolCommandLogos = new Guid(diolCommandLogosString); 26 | } 27 | /// 28 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 29 | /// 30 | internal sealed partial class PackageIds 31 | { 32 | public const int DiolToolWindowCommandId = 0x0100; 33 | public const int bmpPic1 = 0x0001; 34 | public const int bmpPic2 = 0x0002; 35 | public const int bmpPicSearch = 0x0003; 36 | public const int bmpPicX = 0x0004; 37 | public const int bmpPicArrows = 0x0005; 38 | public const int bmpPicStrikethrough = 0x0006; 39 | public const int diolCommandLogo1 = 0x0001; 40 | } 41 | } -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/WelcomeComponent.xaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 19 | 20 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 34 | 36 | 37 | 38 | 39 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/ViewModels/EntityFrameworkComponentViewModel.cs: -------------------------------------------------------------------------------- 1 | using Diol.Wpf.Core.Features.EntityFrameworks; 2 | using Prism.Events; 3 | using Prism.Mvvm; 4 | using System.Windows; 5 | 6 | namespace Diol.Wpf.Core.ViewModels 7 | { 8 | /// 9 | /// Represents the view model for the EntityFrameworkComponent. 10 | /// 11 | public class EntityFrameworkComponentViewModel : BindableBase 12 | { 13 | private IEventAggregator eventAggregator; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The event aggregator. 19 | public EntityFrameworkComponentViewModel(IEventAggregator eventAggregator) 20 | { 21 | this.eventAggregator = eventAggregator; 22 | 23 | this.eventAggregator 24 | .GetEvent() 25 | .Subscribe(HandleEntityFrameworkItemSelectedEvent, ThreadOption.UIThread); 26 | } 27 | 28 | private GridLength _detailWidth = new GridLength(0, GridUnitType.Star); 29 | 30 | /// 31 | /// Gets or sets the width of the detail. 32 | /// 33 | public GridLength DetailWidth 34 | { 35 | get => this._detailWidth; 36 | set => SetProperty(ref this._detailWidth, value); 37 | } 38 | 39 | private void HandleEntityFrameworkItemSelectedEvent(string obj) 40 | { 41 | if (string.IsNullOrEmpty(obj)) 42 | { 43 | // handle close 44 | this.DetailWidth = new GridLength(0, GridUnitType.Star); 45 | } 46 | else 47 | { 48 | // handle open 49 | this.DetailWidth = new GridLength(1, GridUnitType.Star); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/TraceEventProcessors/ProcessorFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Diol.Core.TraceEventProcessors 5 | { 6 | /// 7 | /// Represents a factory for creating processors. 8 | /// 9 | public interface IProcessorFactory 10 | { 11 | /// 12 | /// Gets the collection of processors. 13 | /// 14 | /// The collection of processors. 15 | ICollection GetProcessors(); 16 | 17 | /// 18 | /// Gets the processor based on the logger name and event name. 19 | /// 20 | /// The logger name. 21 | /// The event name. 22 | /// The processor. 23 | IProcessor GetProcessor(string loggerName, string eventName); 24 | } 25 | 26 | /// 27 | /// Represents a factory for creating processors. 28 | /// 29 | public class ProcessorFactory : IProcessorFactory 30 | { 31 | private readonly IEnumerable processors; 32 | 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// 36 | /// The collection of processors. 37 | public ProcessorFactory(IEnumerable processors) 38 | { 39 | this.processors = processors; 40 | } 41 | 42 | /// 43 | public ICollection GetProcessors() 44 | { 45 | return this.processors.ToList(); 46 | } 47 | 48 | /// 49 | public IProcessor GetProcessor(string loggerName, string eventName) 50 | { 51 | return this.processors.FirstOrDefault( 52 | p => p.CheckEvent(loggerName, eventName)); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Diol 6 | Dotnet Input-Output Logger (DIOL) is a free and open-source tool created for .NET developers. 7 | With DIOL, you can easily see and explore logs during debugging your .NET application in real time. 8 | Say goodbye to tons of log messages in your code! 9 | https://github.com/Dotnet-IO-logger/core/wiki 10 | https://github.com/Dotnet-IO-logger/core/wiki/1.-Getting-started-guide 11 | Resources\logo.png 12 | logger 13 | 14 | 15 | 16 | amd64 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Https/HttpViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System; 3 | 4 | namespace Diol.Wpf.Core.Features.Https 5 | { 6 | /// 7 | /// Represents a view model for making HTTP requests. 8 | /// 9 | public class HttpViewModel : BindableBase 10 | { 11 | private string _key; 12 | 13 | /// 14 | /// Gets or sets the key for the HTTP request. 15 | /// 16 | public string Key 17 | { 18 | get => this._key; 19 | set => SetProperty(ref this._key, value); 20 | } 21 | 22 | private string _method; 23 | 24 | /// 25 | /// Gets or sets the HTTP method for the request. 26 | /// 27 | public string Method 28 | { 29 | get => this._method; 30 | set => SetProperty(ref this._method, value); 31 | } 32 | 33 | private string _uri; 34 | 35 | /// 36 | /// Gets or sets the URI for the HTTP request. 37 | /// 38 | public string Uri 39 | { 40 | get => this._uri; 41 | set => SetProperty(ref this._uri, value); 42 | } 43 | 44 | private int? _responseStatusCode; 45 | 46 | /// 47 | /// Gets or sets the response status code of the HTTP request. 48 | /// 49 | public int? ResponseStatusCode 50 | { 51 | get => this._responseStatusCode; 52 | set => SetProperty(ref this._responseStatusCode, value); 53 | } 54 | 55 | private TimeSpan? _durationInMiliSeconds; 56 | 57 | /// 58 | /// Gets or sets the duration of the HTTP request in milliseconds. 59 | /// 60 | public TimeSpan? DurationInMiliSeconds 61 | { 62 | get => this._durationInMiliSeconds; 63 | set => SetProperty(ref this._durationInMiliSeconds, value); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/EntityFrameworks/EntityFrameworkViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System; 3 | 4 | namespace Diol.Wpf.Core.Features.EntityFrameworks 5 | { 6 | /// 7 | /// Represents a view model for Entity Framework. 8 | /// 9 | public class EntityFrameworkViewModel : BindableBase 10 | { 11 | private string _key; 12 | 13 | /// 14 | /// Gets or sets the key. 15 | /// 16 | public string Key 17 | { 18 | get => this._key; 19 | set => SetProperty(ref this._key, value); 20 | } 21 | 22 | private string _server; 23 | 24 | /// 25 | /// Gets or sets the server. 26 | /// 27 | public string Server 28 | { 29 | get => this._server; 30 | set => SetProperty(ref this._server, value); 31 | } 32 | 33 | private string _database; 34 | 35 | /// 36 | /// Gets or sets the database. 37 | /// 38 | public string Database 39 | { 40 | get => this._database; 41 | set => SetProperty(ref this._database, value); 42 | } 43 | 44 | private TimeSpan? _durationInMiliSeconds; 45 | 46 | private string _operation; 47 | public string Operation 48 | { 49 | get => this._operation; 50 | set => SetProperty(ref this._operation, value); 51 | } 52 | 53 | private string _table; 54 | public string Table 55 | { 56 | get => this._table; 57 | set => SetProperty(ref this._table, value); 58 | } 59 | 60 | /// 61 | /// Gets or sets the duration in milliseconds. 62 | /// 63 | public TimeSpan? DurationInMiliSeconds 64 | { 65 | get => this._durationInMiliSeconds; 66 | set => SetProperty(ref this._durationInMiliSeconds, value); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/TraceEventProcessors/TraceEventRouter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Diagnostics.Tracing; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Diol.Core.TraceEventProcessors 6 | { 7 | /// 8 | /// Represents a router for trace events. 9 | /// 10 | public class TraceEventRouter : IObservable 11 | { 12 | private readonly IProcessorFactory processorFactory; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The processor factory. 18 | public TraceEventRouter( 19 | IProcessorFactory processorFactory) 20 | { 21 | this.processorFactory = processorFactory; 22 | } 23 | 24 | /// 25 | /// Subscribes an observer to receive trace events. 26 | /// 27 | /// The observer to subscribe. 28 | /// An representing the subscription. 29 | public IDisposable Subscribe(IObserver observer) => 30 | new TraceEventRouterUnSubscriber( 31 | new List>( 32 | this.processorFactory.GetProcessors())); 33 | 34 | /// 35 | /// Routes a trace event to the correct processor. 36 | /// 37 | /// The trace event to route. 38 | public void TraceEvent(TraceEvent traceEvent) 39 | { 40 | // route traceEvent to the correct processor 41 | var loggerName = traceEvent.PayloadByName("LoggerName")?.ToString(); 42 | 43 | if (loggerName == null) 44 | return; 45 | 46 | var processor = this.processorFactory.GetProcessor( 47 | loggerName, 48 | traceEvent.EventName); 49 | 50 | if (processor == null) 51 | return; 52 | 53 | processor.OnNext(traceEvent); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/Diol/src/applications/DiolVSIX/DiolBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using Diol.Wpf.Core; 2 | using Diol.Wpf.Core.Services; 3 | using Diol.Wpf.Core.Views; 4 | using DiolVSIX.Services; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Shell; 8 | using Prism.Events; 9 | using Prism.Ioc; 10 | using Prism.Modularity; 11 | using Prism.Unity; 12 | using System.Windows; 13 | 14 | namespace DiolVSIX 15 | { 16 | public class DiolBootstrapper : PrismBootstrapper 17 | { 18 | private readonly DiolToolWindowControl diolToolWindow; 19 | 20 | public DiolBootstrapper( 21 | DiolToolWindowControl diolToolWindow) 22 | { 23 | this.diolToolWindow = diolToolWindow; 24 | } 25 | 26 | protected override DependencyObject CreateShell() 27 | { 28 | var mw = this.Container.Resolve(); 29 | 30 | this.diolToolWindow.Content = mw; 31 | 32 | return mw; 33 | } 34 | 35 | protected override void RegisterTypes(IContainerRegistry containerRegistry) 36 | { 37 | ThreadHelper.ThrowIfNotOnUIThread(); 38 | var applicationObject = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2; 39 | var debuggerEvents = applicationObject.Events.DebuggerEvents; 40 | 41 | // register all services here 42 | containerRegistry.AddDiolWpf( 43 | (IContainerProvider container) => 44 | { 45 | return new VsProcessProvider(applicationObject); 46 | }, 47 | (IContainerProvider container) => 48 | { 49 | var eventAggregator = container.Resolve(); 50 | return new VsApplicationStateService(debuggerEvents, eventAggregator); 51 | }); 52 | } 53 | 54 | protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) 55 | { 56 | base.ConfigureModuleCatalog(moduleCatalog); 57 | moduleCatalog.AddModule(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/ViewModels/WelcomeComponentViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Commands; 2 | using Prism.Mvvm; 3 | using Prism.Regions; 4 | 5 | namespace Diol.Wpf.Core.ViewModels 6 | { 7 | /// 8 | /// View model for the WelcomeComponent. 9 | /// 10 | public class WelcomeComponentViewModel : BindableBase 11 | { 12 | private readonly IRegionManager regionManager; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The region manager. 18 | public WelcomeComponentViewModel(IRegionManager regionManager) 19 | { 20 | this.regionManager = regionManager; 21 | } 22 | 23 | #region Status 24 | private string _status; 25 | 26 | /// 27 | /// Gets or sets the status message. 28 | /// 29 | public string StatusMessage 30 | { 31 | get { return this._status; } 32 | set { SetProperty(ref this._status, value); } 33 | } 34 | 35 | private bool _canGo = true; 36 | 37 | /// 38 | /// Gets or sets a value indicating whether the Go command can be executed. 39 | /// 40 | public bool CanGo 41 | { 42 | get { return this._canGo; } 43 | set { SetProperty(ref this._canGo, value); } 44 | } 45 | #endregion 46 | 47 | #region GoCommand 48 | private DelegateCommand _goCommand; 49 | 50 | /// 51 | /// Gets the Go command. 52 | /// 53 | public DelegateCommand GoCommand => 54 | this._goCommand ?? (this._goCommand = new DelegateCommand(ExecuteGoCommand)); 55 | 56 | private void ExecuteGoCommand() 57 | { 58 | this.CanGo = false; 59 | 60 | this.StatusMessage = "Searching..."; 61 | 62 | // navigate to main component 63 | this.regionManager.RequestNavigate("MainRegion", "MainComponent"); 64 | 65 | this.CanGo = true; 66 | } 67 | #endregion 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Diol.Core.DiagnosticClients; 2 | using Diol.Core.Features; 3 | using Diol.Core.TraceEventProcessors; 4 | using Diol.Share.Consumers; 5 | using Diol.Share.Services; 6 | using Microsoft.Extensions.DependencyInjection; 7 | 8 | namespace Diol.Core 9 | { 10 | /// 11 | /// Extension methods for configuring Diol Core services. 12 | /// 13 | public static class ServiceCollectionExtensions 14 | { 15 | /// 16 | /// Adds Diol Core services to the specified . 17 | /// 18 | /// The type of the consumer. 19 | /// The type of the process provider. 20 | /// The type of the application state service. 21 | /// The to add the services to. 22 | /// The modified . 23 | public static IServiceCollection AddDiolCore< 24 | TConsumer, 25 | TProcessProvider, 26 | TApplicationStateService>( 27 | this IServiceCollection services) 28 | where TConsumer : class, IConsumer 29 | where TProcessProvider : class, IProcessProvider 30 | where TApplicationStateService : class, IApplicationStateService 31 | { 32 | services.AddSingleton(); 33 | services.AddSingleton(); 34 | services.AddSingleton(); 35 | services.AddSingleton(); 36 | 37 | services.AddSingleton(); 38 | services.AddSingleton(); 39 | services.AddSingleton(); 40 | 41 | services.AddSingleton(); 42 | services.AddSingleton(); 43 | services.AddSingleton(); 44 | 45 | return services; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/MainComponent.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 30 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to Diol! 2 | 3 | ![diol-main-banner](/content/images/diol-main-banner.png) 4 | 5 | **Dotnet Input-Output Logger (DIOL)** is a free and open-source tool created for .NET developers. With DIOL, you can easily see and explore logs during debugging your .NET application in real time. 6 | 7 | Say **goodbye** to tons of log messages in your code! 8 | 9 | ## Features 10 | 11 | DIOL offers a **99.9% zero-touch approach**. Just plug and play! There’s no need to install any external dependencies to your project or modify your existing code. DIOL supports the following log types: 12 | 13 | * **HTTP** requests and responses 14 | * **ASP.NET Core** (controllers and minimal API) 15 | * **SQL** (Entity Framework) 16 | * **WebSockets & SignalR** (coming soon) 17 | * **gRPC** (coming soon) 18 | 19 | DIOL can also be integrated with third-party SDKs that have standard internal implementation and use the default .NET logging system 20 | 21 | ## How to use 22 | 23 | Start debugging your .NET application, call your endpoint, and watch your logs in the DIOL tool window! [See more](https://github.com/Dotnet-IO-logger/core/wiki) 24 | 25 | ![main](/content/images/diol-main-image.png) 26 | 27 | ### DEMOs 28 | 29 | We have prepared DEMOs on how to set up and use DIOL, and we’ve divided them by areas. 30 | 31 | | Name | Duration | Description | 32 | | :--- | :--- | :--- | 33 | | [HttpClient demo](https://github.com/Dotnet-IO-logger/Playground/tree/main/source/Diol.Demo/src/Example1HttpLoggingSample) | ~5 minutes | How to setup DIOL to for HttpClient logs | 34 | | [AspNET endpoints demo](https://github.com/Dotnet-IO-logger/Playground/tree/main/source/Diol.Demo/src/Example2AspnetEndpointLoggingSample) | ~5 minutes | How to setup DIOL for asp.net endpoints and controllers logs | 35 | | [EntityFramework demo](https://github.com/Dotnet-IO-logger/Playground/tree/main/source/Diol.Demo/src/Example3EntityFrameworkLoggingSample) | ~15 minutes | How to setup DIOL for EntityFramework logs | 36 | 37 | ## Additional feature 38 | 39 | In case you want to reuse DIOL logic for your application you may want to check [diol backend service doc](https://github.com/Dotnet-IO-logger/core/wiki/1.-Diol-backend-service). 40 | 41 | Highlights: 42 | 43 | * **Easy to install**: Distributed as a dotnet cli command. Can be installed via `dotnet install` command. 44 | * **SignalR service**: Supports realtime notification for each log. 45 | 46 | ## Feedback and contribution 47 | 48 | We are open to new ideas and help from the community! 49 | 50 | Please feel free to check out our **Wiki** for more information. 51 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Aspnet/ServiceCollection.cs: -------------------------------------------------------------------------------- 1 | using Diol.Aspnet.BackgroundWorkers; 2 | using Diol.Aspnet.Consumers; 3 | using Diol.Aspnet.Hubs; 4 | using Diol.Core; 5 | using Diol.Share.Services; 6 | using Microsoft.AspNetCore.Builder; 7 | using Microsoft.AspNetCore.Routing; 8 | using Microsoft.AspNetCore.SignalR; 9 | using Microsoft.Extensions.DependencyInjection; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace Diol.Aspnet 13 | { 14 | /// 15 | /// Provides extension methods to configure DIOL web services. 16 | /// 17 | public static class ServiceCollection 18 | { 19 | /// 20 | /// Adds DIOL web services to the specified . 21 | /// 22 | /// The to add the services to. 23 | /// The modified . 24 | public static IServiceCollection AddDiolWeb(this IServiceCollection services) 25 | { 26 | services.AddLogging(); 27 | 28 | services.AddSignalR(setting => 29 | { 30 | setting.EnableDetailedErrors = true; 31 | }); 32 | 33 | services.AddDiolCore< 34 | SignalRConsumer, 35 | LocalDevelopmentProcessProvider, 36 | LocalApplicationStateService>(); 37 | 38 | services.AddHostedService(); 39 | services.AddSingleton(ctx => 40 | { 41 | var hubContext = ctx.GetRequiredService>(); 42 | var loggerFactory = ctx.GetRequiredService(); 43 | var logger = loggerFactory.CreateLogger(); 44 | return new BackgroundTaskQueue(hubContext, logger); 45 | }); 46 | 47 | return services; 48 | } 49 | } 50 | 51 | /// 52 | /// Provides extension methods to configure DIOL web application. 53 | /// 54 | public static class WebApplicationCollection 55 | { 56 | /// 57 | /// Maps the DIOL logs hub to the specified endpoint. 58 | /// 59 | /// The to map the hub to. 60 | /// The modified . 61 | public static IEndpointRouteBuilder UseDiol(this IEndpointRouteBuilder builder) 62 | { 63 | builder.MapHub("/logsHub"); 64 | 65 | return builder; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Features/Shared/SharedEvents.cs: -------------------------------------------------------------------------------- 1 | using Diol.Share.Utils; 2 | using Prism.Events; 3 | using System.Collections.Generic; 4 | 5 | namespace Diol.Wpf.Core.Features.Shared 6 | { 7 | /// 8 | /// Event that is raised to clear data. 9 | /// 10 | public class ClearDataEvent : PubSubEvent 11 | { 12 | } 13 | 14 | /// 15 | /// Event that is raised when debug mode is run. 16 | /// 17 | public class DebugModeRunnedEvent : PubSubEvent 18 | { 19 | } 20 | 21 | /// 22 | /// Event that is raised for diagnostic purposes. 23 | /// 24 | public class DiagnosticEvent : PubSubEvent 25 | { 26 | } 27 | 28 | /// 29 | /// Model for diagnostic information. 30 | /// 31 | public class DiagnosticModel 32 | { 33 | /// 34 | /// Gets or sets the category name. 35 | /// 36 | public string CategoryName { get; set; } 37 | 38 | /// 39 | /// Gets or sets the event name. 40 | /// 41 | public string EventName { get; set; } 42 | 43 | /// 44 | /// Gets or sets the activity ID. 45 | /// 46 | public string ActivityId { get; set; } 47 | } 48 | 49 | /// 50 | /// Event that is raised when processes are received. 51 | /// 52 | public class ProcessesReceivedEvent : PubSubEvent> 53 | { 54 | } 55 | 56 | /// 57 | /// Enum representing the SignalR connection status. 58 | /// 59 | public enum SignalRConnectionEnum 60 | { 61 | Connecting, 62 | Connected, 63 | Reconnecting, 64 | Reconnected, 65 | Closed, 66 | Error 67 | } 68 | 69 | /// 70 | /// Event that is raised for SignalR connection status changes. 71 | /// 72 | public class SignalRConnectionEvent : PubSubEvent 73 | { 74 | } 75 | 76 | /// 77 | /// Event that is raised when a process is started. 78 | /// 79 | public class ProcessStarted : PubSubEvent 80 | { 81 | } 82 | 83 | /// 84 | /// Event that is raised when a process is finished. 85 | /// 86 | public class ProcessFinished : PubSubEvent 87 | { 88 | } 89 | 90 | /// 91 | /// Event that is raised when the backend is started. 92 | /// 93 | public class BackendStarted : PubSubEvent 94 | { 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/DiagnosticClients/EventPipeEventSourceBuilder.cs: -------------------------------------------------------------------------------- 1 | using Diol.Core.TraceEventProcessors; 2 | using Diol.Share.Consumers; 3 | using Microsoft.Diagnostics.NETCore.Client; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace Diol.Core.DiagnosticClients 8 | { 9 | /// 10 | /// Builder class for creating an EventPipeEventSourceWrapper. 11 | /// 12 | public class EventPipeEventSourceBuilder 13 | { 14 | private IProcessorFactory processorFactory; 15 | 16 | /// 17 | /// Gets or sets the process ID for the EventPipeEventSource. 18 | /// 19 | public int ProcessId { get; private set; } 20 | 21 | /// 22 | /// Sets the process ID for the EventPipeEventSource. 23 | /// 24 | /// The process ID. 25 | /// The EventPipeEventSourceBuilder instance. 26 | public EventPipeEventSourceBuilder SetProcessId(int processId) 27 | { 28 | this.ProcessId = processId; 29 | return this; 30 | } 31 | 32 | /// 33 | /// Gets the list of EventPipeProviders. 34 | /// 35 | public List Providers => EventPipeHelper.Providers.ToList(); 36 | 37 | /// 38 | /// Gets or sets the list of consumers. 39 | /// 40 | public IEnumerable Consumers { get; private set; } 41 | 42 | /// 43 | /// Gets or sets the event observer. 44 | /// 45 | public EventPublisher EventObserver { get; private set; } 46 | 47 | /// 48 | /// Initializes a new instance of the EventPipeEventSourceBuilder class. 49 | /// 50 | /// The list of consumers. 51 | /// The processor factory. 52 | /// The event observer. 53 | public EventPipeEventSourceBuilder( 54 | IEnumerable consumers, 55 | IProcessorFactory processorFactory, 56 | EventPublisher eventObserver) 57 | { 58 | this.Consumers = consumers; 59 | this.processorFactory = processorFactory; 60 | this.EventObserver = eventObserver; 61 | } 62 | 63 | /// 64 | /// Builds the EventPipeEventSourceWrapper. 65 | /// 66 | /// The EventPipeEventSourceWrapper instance. 67 | public EventPipeEventSourceWrapper Build() 68 | { 69 | foreach (var consumer in this.Consumers) 70 | this.EventObserver.Subscribe(consumer); 71 | 72 | return new EventPipeEventSourceWrapper( 73 | this, 74 | new TraceEventRouter(this.processorFactory)); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Core/DiagnosticClients/EventPipeEventSourceWrapper.cs: -------------------------------------------------------------------------------- 1 | using Diol.Core.TraceEventProcessors; 2 | using Microsoft.Diagnostics.NETCore.Client; 3 | using Microsoft.Diagnostics.Tracing; 4 | using System; 5 | 6 | namespace Diol.Core.DiagnosticClients 7 | { 8 | /// 9 | /// Wrapper class for EventPipeEventSource that provides functionality to start and stop event tracing. 10 | /// 11 | public class EventPipeEventSourceWrapper : IDisposable 12 | { 13 | private readonly EventPipeEventSourceBuilder builder; 14 | private readonly TraceEventRouter traceEventRouter; 15 | private EventPipeEventSource source; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The EventPipeEventSourceBuilder instance. 21 | /// The TraceEventRouter instance. 22 | public EventPipeEventSourceWrapper( 23 | EventPipeEventSourceBuilder builder, 24 | TraceEventRouter traceEventRouter) 25 | { 26 | this.traceEventRouter = traceEventRouter; 27 | this.builder = builder; 28 | } 29 | 30 | /// 31 | /// Starts the event tracing. 32 | /// 33 | public void Start() 34 | { 35 | try 36 | { 37 | var client = new DiagnosticsClient(this.builder.ProcessId); 38 | using (var session = client.StartEventPipeSession(this.builder.Providers, false)) 39 | { 40 | this.source = new EventPipeEventSource(session.EventStream); 41 | 42 | this.source.Dynamic.All += this.traceEventRouter.TraceEvent; 43 | 44 | this.source.Process(); 45 | } 46 | } 47 | catch (Exception ex) 48 | { 49 | Console.Error.WriteLine(ex.ToString()); 50 | } 51 | finally 52 | { 53 | // Unsubscribe from the event 54 | if (this.source != null) 55 | { 56 | this.source.Dynamic.All -= this.traceEventRouter.TraceEvent; 57 | this.source.Dispose(); 58 | } 59 | } 60 | } 61 | 62 | /// 63 | /// Stops the event tracing. 64 | /// 65 | public void Stop() 66 | { 67 | try 68 | { 69 | this.source.StopProcessing(); 70 | } 71 | catch (Exception ex) 72 | { 73 | Console.Error.WriteLine(ex.ToString()); 74 | } 75 | } 76 | 77 | /// 78 | /// Disposes the EventPipeEventSource instance. 79 | /// 80 | public void Dispose() 81 | { 82 | this.source?.Dispose(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Aspnet/Hubs/LogsHub.cs: -------------------------------------------------------------------------------- 1 | using Diol.Aspnet.BackgroundWorkers; 2 | using Diol.Share.Services; 3 | using Microsoft.AspNetCore.SignalR; 4 | using Microsoft.Extensions.Logging; 5 | 6 | namespace Diol.Aspnet.Hubs 7 | { 8 | /// 9 | /// Represents a SignalR hub for managing logs. 10 | /// 11 | public class LogsHub : Hub 12 | { 13 | private readonly BackgroundTaskQueue taskQueue; 14 | private readonly DotnetProcessesService dotnetProcessesService; 15 | private readonly ILogger logger; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The background task queue. 21 | /// The DotnetProcessesService instance. 22 | /// The logger instance. 23 | public LogsHub( 24 | BackgroundTaskQueue taskQueue, 25 | DotnetProcessesService dotnetProcessesService, 26 | ILogger logger) 27 | { 28 | this.taskQueue = taskQueue; 29 | this.dotnetProcessesService = dotnetProcessesService; 30 | this.logger = logger; 31 | } 32 | 33 | /// 34 | /// Gets the processes. 35 | /// 36 | /// The message. 37 | /// A task representing the asynchronous operation. 38 | public async Task GetProcesses(string message) 39 | { 40 | var processes = this.dotnetProcessesService.GetCollection(); 41 | 42 | await this.Clients.Caller 43 | .SendAsync("ProcessesReceived", processes); 44 | } 45 | 46 | /// 47 | /// Subscribes to a process. 48 | /// 49 | /// The process ID. 50 | /// A task representing the asynchronous operation. 51 | public async Task Subscribe(int processId) 52 | { 53 | await this.Groups.AddToGroupAsync( 54 | this.Context.ConnectionId, 55 | processId.ToString()); 56 | 57 | await this.Clients.Caller 58 | .SendAsync("ProcessingStarted", processId); 59 | 60 | await this.taskQueue.QueueLogsProcessing(processId); 61 | } 62 | 63 | /// 64 | /// Called when a client is connected. 65 | /// 66 | /// A task representing the asynchronous operation. 67 | public override async Task OnConnectedAsync() 68 | { 69 | this.logger.LogInformation( 70 | "Client connected: {connectionId}", 71 | this.Context.ConnectionId); 72 | 73 | await this.Clients.Caller 74 | .SendAsync("DiolLogsHubConnected"); 75 | 76 | await base.OnConnectedAsync(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /source/Diol/src/Diol.Wpf.Core/Views/EntityFrameworkDetail.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 |