EasilyNET.Mongo.ConsoleDebug 3.24.1007.185

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasilyNET.Mongo.ConsoleDebug --version 3.24.1007.185
                    
NuGet\Install-Package EasilyNET.Mongo.ConsoleDebug -Version 3.24.1007.185
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasilyNET.Mongo.ConsoleDebug" Version="3.24.1007.185" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasilyNET.Mongo.ConsoleDebug" Version="3.24.1007.185" />
                    
Directory.Packages.props
<PackageReference Include="EasilyNET.Mongo.ConsoleDebug" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasilyNET.Mongo.ConsoleDebug --version 3.24.1007.185
                    
#r "nuget: EasilyNET.Mongo.ConsoleDebug, 3.24.1007.185"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=EasilyNET.Mongo.ConsoleDebug&version=3.24.1007.185
                    
Install EasilyNET.Mongo.ConsoleDebug as a Cake Addin
#tool nuget:?package=EasilyNET.Mongo.ConsoleDebug&version=3.24.1007.185
                    
Install EasilyNET.Mongo.ConsoleDebug as a Cake Tool

EasilyNET.Mongo.ConsoleDebug

常使用 EF 的小伙伴就应该能够知道,可以让 EF 生产的 SQL 语句输出到控制台,在开发的时候非常方便调试.<br/> 而 MongoDB 却没有这样的功能,所以产生了这个库,虽然不完美,但是能够解决一些开发过程中不方便排查问题的情况.

  • 最终效果类似如下:
 ╭───────────────────────────────Command─────────────────────────╮╭──────────────────Calendar──────────────────╮
 │ {                                                             ││                2023 August                 │
 │   "insert" : "mongo.test",                                    ││ ┌─────┬─────┬─────┬─────┬─────┬─────┬────┐ │
 │   "ordered" : true,                                           ││ │ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ S… │ │
 │   "$db" : "test1",                                            ││ ├─────┼─────┼─────┼─────┼─────┼─────┼────┤ │
 │   "lsid" : {                                                  ││ │     │     │ 1   │ 2   │ 3   │ 4   │ 5  │ │
 │     "id" : CSUUID("f12dd90d-2f58-4655-9bf2-cbce2d9bd2c4")     ││ │ 6   │ 7   │ 8   │ 9   │ 10  │ 11  │ 12 │ │
 │   },                                                          ││ │ 13  │ 14  │ 15  │ 16  │ 17  │ 18  │ 19 │ │
 │   "documents" : [{                                            ││ │ 20  │ 21  │ 22  │ 23* │ 24  │ 25  │ 26 │ │
 │       "_id" : ObjectId("64e57f266a1a63e69c52b9cb"),           ││ │ 27  │ 28  │ 29  │ 30  │ 31  │     │    │ │
 │       "dateTime" : ISODate("2023-08-23T03:38:14.121Z"),       ││ │     │     │     │     │     │     │    │ │
 │       "timeSpan" : "00:00:50",                                ││ └─────┴─────┴─────┴─────┴─────┴─────┴────┘ │
 │       "dateOnly" : "2023-08-23",                              │╰────────────────────────────────────────────╯
 │       "timeOnly" : "11:38:14",                                │╭────────────────────Info────────────────────╮
 │       "nullableDateOnly" : "2023-08-23",                      ││ {                                          │
 │       "nullableTimeOnly" : null                               ││    "RequestId": 86,                        │
 │     }]                                                        ││    "Timestamp": "2023-08-23 03:38:14",     │
 │ }                                                             ││    "Method": "insert",                     │
 │                                                               ││    "DatabaseName": "test1",                │
 │                                                               ││    "CollectionName": "mongo.test",         │
 │                                                               ││    "ConnectionInfo": {                     │
 │                                                               ││       "ClusterId": 1,                      │
 │                                                               ││       "EndPoint": "127.0.0.1:27018"        │
 │                                                               ││    }                                       │
 │                                                               ││ }                                          │
 │                                                               │╰────────────────────────────────────────────╯
 │                                                               │╭───────────────Request Status───────────────╮
 │                                                               ││ ┌───────────┬────────────────┬───────────┐ │
 │                                                               ││ │ RequestId │      Time      │  Status   │ │
 │                                                               ││ ├───────────┼────────────────┼───────────┤ │
 │                                                               ││ │    86     │ 11:38:14.12640 │ Succeeded │ │
 │                                                               ││ └───────────┴────────────────┴───────────┘ │
 │                                                               │╰────────────────────────────────────────────╯
 │                                                               │╭───────────────────NiuNiu───────────────────╮
 │                                                               ││   --------------------------------------   │
 │                                                               ││ /     Only two things are infinite,      \ │
 │                                                               ││ \   the universe and human stupidity.    / │
 │                                                               ││   --------------------------------------   │
 │                                                               ││              ^__^     O   ^__^             │
 │                                                               ││      _______/(oo)      o  (oo)\_______     │
 │                                                               ││  /\/(       /(__)         (__)\       )\/\ │
 │                                                               ││     ||w----||                 ||----w||    │
 │                                                               ││     ||     ||                 ||     ||    │
 │                                                               ││ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │
 ╰───────────────────────────────────────────────────────────────╯╰────────────────────────────────────────────╯

使用方法

  • 使用默认值配置
var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
clientSettings.ClusterConfigurator = cb => cb.Subscribe(new ActivityEventSubscriber());
var mongoClient = new MongoClient(clientSettings);
  • 使用集合名称进行过滤
var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
// 定义需要输出的集合
HashSet<string> CommandsWithCollectionName = new()
{
    "mongo.test"
};
var options = new InstrumentationOptions()
{
    Enable = true,
    ShouldStartCollection = coll => CommandsWithCollectionName.Contains(coll)
};
clientSettings.ClusterConfigurator = cb => cb.Subscribe(new ActivityEventSubscriber(options));
var mongoClient = new MongoClient(clientSettings);
Seilog 配置例子
// 添加Serilog配置
builder.Host.UseSerilog((hbc, lc) =>
{
    const LogEventLevel logLevel = LogEventLevel.Information;
    lc.ReadFrom.Configuration(hbc.Configuration)
          .MinimumLevel.Override("Microsoft", logLevel)
          .MinimumLevel.Override("System", logLevel)
          .Enrich.FromLogContext()
          .WriteTo.Async(wt =>
          {
              wt.Debug();
              // 输出到 Spectre.Console
              wt.SpectreConsole();
          });
});

同时参考MongoDB.Driver.Core.Extensions.DiagnosticSources

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.25.605.171 0 3 hours ago
4.25.605.104 0 10 hours ago
4.25.602.41 37 4 days ago
4.25.526.140 117 10 days ago
4.25.513.101 206 23 days ago
4.25.506.150 121 a month ago
4.25.429.162 125 a month ago
4.25.429.103 148 a month ago
4.25.411.142 123 2 months ago
4.25.409.92 133 2 months ago
4.25.403.133 129 2 months ago
4.25.319.113 133 3 months ago
4.25.312.103 139 3 months ago
4.25.227.135 85 3 months ago
4.25.221.115 77 4 months ago
4.25.212.95 84 4 months ago
4.25.211.140 82 4 months ago
4.25.124.223 67 4 months ago
4.25.116.110 68 5 months ago
4.25.115.121 37 5 months ago
4.25.114.172 59 5 months ago
4.25.109.111 62 5 months ago
4.25.108.182 65 5 months ago
4.25.108.160 64 5 months ago
4.25.1.1 91 5 months ago
3.24.1224.141 75 5 months ago
3.24.1216.116 92 6 months ago
3.24.1206.100 78 6 months ago
3.24.1205.171 81 6 months ago
3.24.1202.150 83 6 months ago
3.24.1126.231 77 6 months ago
3.24.1126.172 76 6 months ago
3.24.1126.114 84 6 months ago
3.24.1126.104 79 6 months ago
3.24.1125.181 61 6 months ago
3.24.1125.104 78 6 months ago
3.24.1121.183 70 6 months ago
3.24.1120.183 74 7 months ago
3.24.1119.31 72 7 months ago
3.24.1115.143 61 7 months ago
3.24.1113.100 78 7 months ago
3.24.1112.125 79 7 months ago
3.24.1107.140 78 7 months ago
3.24.1107.54 72 7 months ago
3.24.1107.34 71 7 months ago
3.24.1105.111 74 7 months ago
3.24.1103.31 85 7 months ago
3.24.1103 80 7 months ago
3.24.1031.135 70 7 months ago
3.24.1031.112 72 7 months ago
3.24.1031.104 74 7 months ago
3.24.1029.142 80 7 months ago
3.24.1025.30 75 7 months ago
3.24.1022.142 63 7 months ago
3.24.1018.204 128 8 months ago
3.24.1018.175 120 8 months ago
3.24.1018.166 120 8 months ago
3.24.1018.93 129 8 months ago
3.24.1017.42 76 8 months ago
3.24.1016.161 77 8 months ago
3.24.1015.231 79 8 months ago
3.24.1015.14 77 8 months ago
3.24.1012.114 78 8 months ago
3.24.1009.115 80 8 months ago
3.24.1008.160 74 8 months ago
3.24.1008.133 83 8 months ago
3.24.1007.185 76 8 months ago
3.24.1003.33 84 8 months ago
3.24.1002.162 78 8 months ago
3.24.929.143 80 8 months ago
3.24.929.141 80 8 months ago
3.24.929.131 80 8 months ago
3.24.929.122 82 8 months ago
3.24.926.184 78 8 months ago
3.24.926.182 78 8 months ago
3.24.926.175 80 8 months ago
3.24.924.160 76 8 months ago
3.24.924.133 83 8 months ago
3.24.924.124 75 8 months ago
3.24.924.10 83 8 months ago
3.24.924.1 79 8 months ago
3.24.923.234 77 8 months ago
3.24.923.232 74 8 months ago
3.24.923.155 82 8 months ago
3.24.919.92 90 9 months ago
3.24.914.125 92 9 months ago
3.24.914.115 80 9 months ago
3.24.914.111 78 9 months ago
3.24.911.95 81 9 months ago
3.24.908.215 68 9 months ago
3.24.904.200 76 9 months ago
3.24.828.163 85 9 months ago
3.24.820.173 91 10 months ago
3.24.814.92 94 10 months ago
3.24.812.115 92 10 months ago
3.24.802.100 65 8/2/2024
3.24.801.162 75 8/1/2024
3.24.801.160 71 8/1/2024
3.24.801.155 73 8/1/2024
3.24.730.164 68 7/30/2024
3.24.730.91 65 7/30/2024
3.24.724.91 69 7/24/2024
3.24.718.105 86 7/18/2024
3.24.716.95 96 7/16/2024
3.24.712.94 76 7/12/2024
3.24.710.14 79 7/9/2024
3.24.709.105 77 7/9/2024
3.24.704.94 81 7/4/2024
3.24.701.90 88 7/1/2024
3.24.628.114 87 6/28/2024
3.24.627.145 79 6/27/2024
3.24.620.160 87 6/20/2024
3.24.613.115 79 6/13/2024
3.24.612.95 80 6/12/2024
3.24.528.90 77 5/28/2024
3.24.522.84 89 5/22/2024
3.24.512.213 83 5/12/2024
3.24.508.112 88 5/8/2024
2.2024.428.71 81 4/28/2024
2.2024.427.1128 128 4/27/2024
2.2.72 159 4/14/2024
2.2.71 82 4/12/2024
2.2.8 121 4/26/2024
2.2.6 83 4/10/2024
2.2.5 96 3/26/2024
2.2.4 95 3/25/2024
2.2.3 99 3/24/2024
2.2.2 100 3/21/2024
2.2.1 96 3/20/2024
2.2.0 102 3/13/2024
2.1.9 102 2/21/2024
2.1.8 107 2/18/2024
2.1.7 97 2/16/2024
2.1.6 105 2/14/2024
2.1.5 104 2/14/2024
2.1.4 104 2/9/2024
2.1.3 100 2/8/2024
2.1.2 102 2/5/2024
2.1.1.2 159 12/26/2023
2.1.1.1 105 12/26/2023
2.1.1 107 12/25/2023
2.1.0 122 12/17/2023
2.0.11 113 12/6/2023
2.0.1 110 11/15/2023
2.0.0 91 11/14/2023
1.9.1 114 11/1/2023
1.9.0 101 10/19/2023
1.9.0-preview2 90 10/12/2023
1.9.0-preview1 78 10/12/2023
1.8.9 109 10/11/2023
1.8.8 107 10/11/2023
1.8.7-rc2 86 9/21/2023
1.8.7-rc1 89 9/12/2023
1.8.6 133 8/31/2023
1.8.5 108 8/25/2023
1.8.4 109 8/24/2023
1.8.3 115 8/23/2023
1.8.2 175 8/22/2023
1.8.1 105 8/18/2023
1.8.0 601 8/15/2023
1.7.9 588 8/11/2023
1.7.8 559 8/11/2023
1.7.7 587 8/10/2023
1.7.6 635 8/9/2023
1.7.5 543 8/9/2023
1.7.4 665 8/3/2023
1.7.3 614 8/1/2023
1.7.2 651 7/31/2023
1.7.1 619 7/27/2023
1.7.0 624 7/25/2023
1.6.9 631 7/25/2023
1.6.8 643 7/24/2023
1.6.7 672 7/20/2023
1.6.6 687 7/19/2023
1.6.5 561 7/19/2023
1.6.4 644 7/17/2023
1.6.3 609 7/17/2023
1.6.2 672 7/12/2023
1.6.1 693 6/30/2023
1.6.0 643 6/26/2023
1.5.9 674 6/22/2023
1.5.8 648 6/15/2023
1.5.7.1 624 6/14/2023
1.5.7 645 6/14/2023
1.5.6.2 671 6/7/2023
1.5.6.1 645 6/7/2023
1.5.6 699 6/7/2023
1.5.5.2 613 5/26/2023
1.5.5.1 657 5/26/2023
1.5.5 688 5/26/2023
1.5.4.4 711 5/25/2023
1.5.4.3 681 5/23/2023
1.5.4.2 775 5/17/2023
1.5.4.1 688 5/16/2023
1.5.4 735 5/11/2023
1.5.3 679 5/11/2023
1.5.2 680 5/10/2023
1.5.1 647 5/10/2023
1.5.0 727 5/6/2023
1.4.0 722 5/5/2023
1.3.9 739 4/23/2023
1.3.8.6 730 4/23/2023
1.3.8.5 637 4/21/2023
1.3.8.1 754 4/12/2023
1.3.8 745 4/11/2023
1.3.7 717 4/9/2023
1.3.6.3 804 4/1/2023
1.3.6.2 721 3/31/2023
1.3.6.1 763 3/31/2023
1.3.6 748 3/31/2023
1.3.5 730 3/30/2023
1.3.4.1 820 3/29/2023
1.3.4 687 3/28/2023
1.3.3 670 3/28/2023
1.3.2 797 3/26/2023
1.3.1 886 3/22/2023
1.3.0 766 3/21/2023
1.2.0 689 3/21/2023
1.1.0 749 3/17/2023
1.0.9 711 3/15/2023
1.0.8 713 3/15/2023
1.0.7 712 3/15/2023
1.0.6 756 3/13/2023
1.0.5 798 3/13/2023
1.0.4 749 3/13/2023
1.0.2 808 2/26/2023
1.0.1 782 2/23/2023
1.0.0 754 2/20/2023