EasilyNET.Mongo.ConsoleDebug 1.9.0-preview1

This package has been deprecated as it has critical bugs.
This is a prerelease version of EasilyNET.Mongo.ConsoleDebug.
There is a newer version of this package available.
See the version list below for details.
dotnet add package EasilyNET.Mongo.ConsoleDebug --version 1.9.0-preview1
                    
NuGet\Install-Package EasilyNET.Mongo.ConsoleDebug -Version 1.9.0-preview1
                    
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="1.9.0-preview1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasilyNET.Mongo.ConsoleDebug" Version="1.9.0-preview1" />
                    
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 1.9.0-preview1
                    
#r "nuget: EasilyNET.Mongo.ConsoleDebug, 1.9.0-preview1"
                    
#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.
#:package EasilyNET.Mongo.ConsoleDebug@1.9.0-preview1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasilyNET.Mongo.ConsoleDebug&version=1.9.0-preview1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=EasilyNET.Mongo.ConsoleDebug&version=1.9.0-preview1&prerelease
                    
Install 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 net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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.724.1 312 3 days ago
4.25.720.80 183 7 days ago
4.25.716.42 111 11 days ago
4.25.617.153 134 a month ago
4.25.616.190 122 a month ago
4.25.616.182 114 a month ago
4.25.613.111 259 a month ago
4.25.609.190 431 2 months ago
4.25.609.181 387 2 months ago 4.25.609.181 is deprecated because it has critical bugs.
4.25.609.163 387 2 months ago 4.25.609.163 is deprecated because it has critical bugs.
4.25.609.140 377 2 months ago 4.25.609.140 is deprecated because it has critical bugs.
4.25.605.171 306 2 months ago 4.25.605.171 is deprecated because it has critical bugs.
4.25.605.104 311 2 months ago 4.25.605.104 is deprecated because it has critical bugs.
4.25.602.41 315 2 months ago 4.25.602.41 is deprecated because it has critical bugs.
4.25.526.140 324 2 months ago 4.25.526.140 is deprecated because it has critical bugs.
4.25.513.101 412 2 months ago 4.25.513.101 is deprecated because it has critical bugs.
4.25.506.150 326 3 months ago 4.25.506.150 is deprecated because it has critical bugs.
4.25.429.162 330 3 months ago 4.25.429.162 is deprecated because it has critical bugs.
4.25.429.103 356 3 months ago 4.25.429.103 is deprecated because it has critical bugs.
4.25.411.142 326 4 months ago 4.25.411.142 is deprecated because it has critical bugs.
4.25.409.92 334 4 months ago 4.25.409.92 is deprecated because it has critical bugs.
4.25.403.133 333 4 months ago 4.25.403.133 is deprecated because it has critical bugs.
4.25.319.113 331 4 months ago 4.25.319.113 is deprecated because it has critical bugs.
4.25.312.103 339 4 months ago 4.25.312.103 is deprecated because it has critical bugs.
4.25.227.135 286 5 months ago 4.25.227.135 is deprecated because it has critical bugs.
4.25.221.115 281 5 months ago 4.25.221.115 is deprecated because it has critical bugs.
4.25.212.95 283 5 months ago 4.25.212.95 is deprecated because it has critical bugs.
4.25.211.140 283 6 months ago 4.25.211.140 is deprecated because it has critical bugs.
4.25.124.223 274 6 months ago 4.25.124.223 is deprecated because it has critical bugs.
4.25.116.110 270 6 months ago 4.25.116.110 is deprecated because it has critical bugs.
4.25.115.121 243 6 months ago 4.25.115.121 is deprecated because it has critical bugs.
4.25.114.172 259 6 months ago 4.25.114.172 is deprecated because it has critical bugs.
4.25.109.111 265 7 months ago 4.25.109.111 is deprecated because it has critical bugs.
4.25.108.182 266 7 months ago 4.25.108.182 is deprecated because it has critical bugs.
4.25.108.160 274 7 months ago 4.25.108.160 is deprecated because it has critical bugs.
4.25.1.1 291 7 months ago 4.25.1.1 is deprecated because it has critical bugs.
3.24.1224.141 274 7 months ago 3.24.1224.141 is deprecated because it has critical bugs.
3.24.1216.116 296 7 months ago 3.24.1216.116 is deprecated because it has critical bugs.
3.24.1206.100 278 8 months ago 3.24.1206.100 is deprecated because it has critical bugs.
3.24.1205.171 282 8 months ago 3.24.1205.171 is deprecated because it has critical bugs.
3.24.1202.150 283 8 months ago 3.24.1202.150 is deprecated because it has critical bugs.
3.24.1126.231 281 8 months ago 3.24.1126.231 is deprecated because it has critical bugs.
3.24.1126.172 281 8 months ago 3.24.1126.172 is deprecated because it has critical bugs.
3.24.1126.114 287 8 months ago 3.24.1126.114 is deprecated because it has critical bugs.
3.24.1126.104 281 8 months ago 3.24.1126.104 is deprecated because it has critical bugs.
3.24.1125.181 263 8 months ago 3.24.1125.181 is deprecated because it has critical bugs.
3.24.1125.104 281 8 months ago 3.24.1125.104 is deprecated because it has critical bugs.
3.24.1121.183 270 8 months ago 3.24.1121.183 is deprecated because it has critical bugs.
3.24.1120.183 275 8 months ago 3.24.1120.183 is deprecated because it has critical bugs.
3.24.1119.31 272 8 months ago 3.24.1119.31 is deprecated because it has critical bugs.
3.24.1115.143 266 8 months ago 3.24.1115.143 is deprecated because it has critical bugs.
3.24.1113.100 281 8 months ago 3.24.1113.100 is deprecated because it has critical bugs.
3.24.1112.125 283 8 months ago 3.24.1112.125 is deprecated because it has critical bugs.
3.24.1107.140 279 9 months ago 3.24.1107.140 is deprecated because it has critical bugs.
3.24.1107.54 274 9 months ago 3.24.1107.54 is deprecated because it has critical bugs.
3.24.1107.34 273 9 months ago 3.24.1107.34 is deprecated because it has critical bugs.
3.24.1105.111 273 9 months ago 3.24.1105.111 is deprecated because it has critical bugs.
3.24.1103.31 287 9 months ago 3.24.1103.31 is deprecated because it has critical bugs.
3.24.1103 282 9 months ago 3.24.1103 is deprecated because it has critical bugs.
3.24.1031.135 276 9 months ago 3.24.1031.135 is deprecated because it has critical bugs.
3.24.1031.112 272 9 months ago 3.24.1031.112 is deprecated because it has critical bugs.
3.24.1031.104 273 9 months ago 3.24.1031.104 is deprecated because it has critical bugs.
3.24.1029.142 281 9 months ago 3.24.1029.142 is deprecated because it has critical bugs.
3.24.1025.30 280 9 months ago 3.24.1025.30 is deprecated because it has critical bugs.
3.24.1022.142 268 9 months ago 3.24.1022.142 is deprecated because it has critical bugs.
3.24.1018.204 331 9 months ago 3.24.1018.204 is deprecated because it has critical bugs.
3.24.1018.175 319 9 months ago 3.24.1018.175 is deprecated because it has critical bugs.
3.24.1018.166 324 9 months ago 3.24.1018.166 is deprecated because it has critical bugs.
3.24.1018.93 331 9 months ago 3.24.1018.93 is deprecated because it has critical bugs.
3.24.1017.42 277 9 months ago 3.24.1017.42 is deprecated because it has critical bugs.
3.24.1016.161 280 9 months ago 3.24.1016.161 is deprecated because it has critical bugs.
3.24.1015.231 278 9 months ago 3.24.1015.231 is deprecated because it has critical bugs.
3.24.1015.14 283 9 months ago 3.24.1015.14 is deprecated because it has critical bugs.
3.24.1012.114 279 9 months ago 3.24.1012.114 is deprecated because it has critical bugs.
3.24.1009.115 286 10 months ago 3.24.1009.115 is deprecated because it has critical bugs.
3.24.1008.160 275 10 months ago 3.24.1008.160 is deprecated because it has critical bugs.
3.24.1008.133 284 10 months ago 3.24.1008.133 is deprecated because it has critical bugs.
3.24.1007.185 283 10 months ago 3.24.1007.185 is deprecated because it has critical bugs.
3.24.1003.33 286 10 months ago 3.24.1003.33 is deprecated because it has critical bugs.
3.24.1002.162 280 10 months ago 3.24.1002.162 is deprecated because it has critical bugs.
3.24.929.143 279 10 months ago 3.24.929.143 is deprecated because it has critical bugs.
3.24.929.141 283 10 months ago 3.24.929.141 is deprecated because it has critical bugs.
3.24.929.131 280 10 months ago 3.24.929.131 is deprecated because it has critical bugs.
3.24.929.122 287 10 months ago 3.24.929.122 is deprecated because it has critical bugs.
3.24.926.184 278 10 months ago 3.24.926.184 is deprecated because it has critical bugs.
3.24.926.182 278 10 months ago 3.24.926.182 is deprecated because it has critical bugs.
3.24.926.175 285 10 months ago 3.24.926.175 is deprecated because it has critical bugs.
3.24.924.160 280 9/24/2024 3.24.924.160 is deprecated because it has critical bugs.
3.24.924.133 290 9/24/2024 3.24.924.133 is deprecated because it has critical bugs.
3.24.924.124 280 9/24/2024 3.24.924.124 is deprecated because it has critical bugs.
3.24.924.10 284 9/23/2024 3.24.924.10 is deprecated because it has critical bugs.
3.24.924.1 281 9/23/2024 3.24.924.1 is deprecated because it has critical bugs.
3.24.923.234 276 9/23/2024 3.24.923.234 is deprecated because it has critical bugs.
3.24.923.232 275 9/23/2024 3.24.923.232 is deprecated because it has critical bugs.
3.24.923.155 283 9/23/2024 3.24.923.155 is deprecated because it has critical bugs.
3.24.919.92 293 9/19/2024 3.24.919.92 is deprecated because it has critical bugs.
3.24.914.125 297 9/14/2024 3.24.914.125 is deprecated because it has critical bugs.
3.24.914.115 280 9/14/2024 3.24.914.115 is deprecated because it has critical bugs.
3.24.914.111 277 9/14/2024 3.24.914.111 is deprecated because it has critical bugs.
3.24.911.95 282 9/11/2024 3.24.911.95 is deprecated because it has critical bugs.
3.24.908.215 272 9/8/2024 3.24.908.215 is deprecated because it has critical bugs.
3.24.904.200 277 9/4/2024 3.24.904.200 is deprecated because it has critical bugs.
3.24.828.163 285 8/28/2024 3.24.828.163 is deprecated because it has critical bugs.
3.24.820.173 296 8/20/2024 3.24.820.173 is deprecated because it has critical bugs.
3.24.814.92 295 8/14/2024 3.24.814.92 is deprecated because it has critical bugs.
3.24.812.115 294 8/12/2024 3.24.812.115 is deprecated because it has critical bugs.
3.24.802.100 269 8/2/2024 3.24.802.100 is deprecated because it has critical bugs.
3.24.801.162 279 8/1/2024 3.24.801.162 is deprecated because it has critical bugs.
3.24.801.160 273 8/1/2024 3.24.801.160 is deprecated because it has critical bugs.
3.24.801.155 274 8/1/2024 3.24.801.155 is deprecated because it has critical bugs.
3.24.730.164 271 7/30/2024 3.24.730.164 is deprecated because it has critical bugs.
3.24.730.91 263 7/30/2024 3.24.730.91 is deprecated because it has critical bugs.
3.24.724.91 269 7/24/2024 3.24.724.91 is deprecated because it has critical bugs.
3.24.718.105 287 7/18/2024 3.24.718.105 is deprecated because it has critical bugs.
3.24.716.95 298 7/16/2024 3.24.716.95 is deprecated because it has critical bugs.
3.24.712.94 278 7/12/2024 3.24.712.94 is deprecated because it has critical bugs.
3.24.710.14 283 7/9/2024 3.24.710.14 is deprecated because it has critical bugs.
3.24.709.105 279 7/9/2024 3.24.709.105 is deprecated because it has critical bugs.
3.24.704.94 281 7/4/2024 3.24.704.94 is deprecated because it has critical bugs.
3.24.701.90 290 7/1/2024 3.24.701.90 is deprecated because it has critical bugs.
3.24.628.114 287 6/28/2024 3.24.628.114 is deprecated because it has critical bugs.
3.24.627.145 278 6/27/2024 3.24.627.145 is deprecated because it has critical bugs.
3.24.620.160 287 6/20/2024 3.24.620.160 is deprecated because it has critical bugs.
3.24.613.115 281 6/13/2024 3.24.613.115 is deprecated because it has critical bugs.
3.24.612.95 284 6/12/2024 3.24.612.95 is deprecated because it has critical bugs.
3.24.528.90 276 5/28/2024 3.24.528.90 is deprecated because it has critical bugs.
3.24.522.84 292 5/22/2024 3.24.522.84 is deprecated because it has critical bugs.
3.24.512.213 286 5/12/2024 3.24.512.213 is deprecated because it has critical bugs.
3.24.508.112 292 5/8/2024 3.24.508.112 is deprecated because it has critical bugs.
2.2024.428.71 284 4/28/2024 2.2024.428.71 is deprecated because it has critical bugs.
2.2.72 358 4/14/2024 2.2.72 is deprecated because it has critical bugs.
2.2.71 282 4/12/2024 2.2.71 is deprecated because it has critical bugs.
2.2.6 288 4/10/2024 2.2.6 is deprecated because it has critical bugs.
2.2.5 297 3/26/2024 2.2.5 is deprecated because it has critical bugs.
2.2.4 296 3/25/2024 2.2.4 is deprecated because it has critical bugs.
2.2.3 297 3/24/2024 2.2.3 is deprecated because it has critical bugs.
2.2.2 300 3/21/2024 2.2.2 is deprecated because it has critical bugs.
2.2.1 295 3/20/2024 2.2.1 is deprecated because it has critical bugs.
2.2.0 301 3/13/2024 2.2.0 is deprecated because it has critical bugs.
2.1.9 305 2/21/2024 2.1.9 is deprecated because it has critical bugs.
2.1.8 309 2/18/2024 2.1.8 is deprecated because it has critical bugs.
2.1.7 300 2/16/2024 2.1.7 is deprecated because it has critical bugs.
2.1.6 307 2/14/2024 2.1.6 is deprecated because it has critical bugs.
2.1.5 305 2/14/2024 2.1.5 is deprecated because it has critical bugs.
2.1.4 305 2/9/2024 2.1.4 is deprecated because it has critical bugs.
2.1.3 302 2/8/2024 2.1.3 is deprecated because it has critical bugs.
2.1.2 304 2/5/2024 2.1.2 is deprecated because it has critical bugs.
2.1.1.2 361 12/26/2023 2.1.1.2 is deprecated because it has critical bugs.
2.1.1.1 303 12/26/2023 2.1.1.1 is deprecated because it has critical bugs.
2.1.1 304 12/25/2023 2.1.1 is deprecated because it has critical bugs.
2.1.0 326 12/17/2023 2.1.0 is deprecated because it has critical bugs.
2.0.11 310 12/6/2023 2.0.11 is deprecated because it has critical bugs.
2.0.1 309 11/15/2023 2.0.1 is deprecated because it has critical bugs.
2.0.0 289 11/14/2023 2.0.0 is deprecated because it has critical bugs.
1.9.1 312 11/1/2023 1.9.1 is deprecated because it has critical bugs.
1.9.0 305 10/19/2023 1.9.0 is deprecated because it has critical bugs.
1.9.0-preview2 295 10/12/2023 1.9.0-preview2 is deprecated because it has critical bugs.
1.9.0-preview1 281 10/12/2023 1.9.0-preview1 is deprecated because it has critical bugs.
1.8.9 315 10/11/2023 1.8.9 is deprecated because it has critical bugs.
1.8.8 311 10/11/2023 1.8.8 is deprecated because it has critical bugs.
1.8.7-rc2 288 9/21/2023 1.8.7-rc2 is deprecated because it has critical bugs.
1.8.7-rc1 291 9/12/2023 1.8.7-rc1 is deprecated because it has critical bugs.
1.8.6 337 8/31/2023 1.8.6 is deprecated because it has critical bugs.
1.8.5 316 8/25/2023 1.8.5 is deprecated because it has critical bugs.
1.8.4 317 8/24/2023 1.8.4 is deprecated because it has critical bugs.
1.8.3 321 8/23/2023 1.8.3 is deprecated because it has critical bugs.
1.8.2 386 8/22/2023 1.8.2 is deprecated because it has critical bugs.
1.8.1 311 8/18/2023 1.8.1 is deprecated because it has critical bugs.