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.716.42 32 2 days ago
4.25.617.153 131 a month ago
4.25.616.190 120 a month ago
4.25.616.182 113 a month ago
4.25.613.111 258 a month ago
4.25.609.190 429 a month ago
4.25.609.181 384 a month ago 4.25.609.181 is deprecated because it has critical bugs.
4.25.609.163 384 a month ago 4.25.609.163 is deprecated because it has critical bugs.
4.25.609.140 375 a month ago 4.25.609.140 is deprecated because it has critical bugs.
4.25.605.171 303 a month ago 4.25.605.171 is deprecated because it has critical bugs.
4.25.605.104 309 a month ago 4.25.605.104 is deprecated because it has critical bugs.
4.25.602.41 313 2 months ago 4.25.602.41 is deprecated because it has critical bugs.
4.25.526.140 322 2 months ago 4.25.526.140 is deprecated because it has critical bugs.
4.25.513.101 410 2 months ago 4.25.513.101 is deprecated because it has critical bugs.
4.25.506.150 324 2 months ago 4.25.506.150 is deprecated because it has critical bugs.
4.25.429.162 329 3 months ago 4.25.429.162 is deprecated because it has critical bugs.
4.25.429.103 354 3 months ago 4.25.429.103 is deprecated because it has critical bugs.
4.25.411.142 325 3 months ago 4.25.411.142 is deprecated because it has critical bugs.
4.25.409.92 333 3 months ago 4.25.409.92 is deprecated because it has critical bugs.
4.25.403.133 332 3 months ago 4.25.403.133 is deprecated because it has critical bugs.
4.25.319.113 329 4 months ago 4.25.319.113 is deprecated because it has critical bugs.
4.25.312.103 338 4 months ago 4.25.312.103 is deprecated because it has critical bugs.
4.25.227.135 284 5 months ago 4.25.227.135 is deprecated because it has critical bugs.
4.25.221.115 280 5 months ago 4.25.221.115 is deprecated because it has critical bugs.
4.25.212.95 282 5 months ago 4.25.212.95 is deprecated because it has critical bugs.
4.25.211.140 282 5 months ago 4.25.211.140 is deprecated because it has critical bugs.
4.25.124.223 272 6 months ago 4.25.124.223 is deprecated because it has critical bugs.
4.25.116.110 269 6 months ago 4.25.116.110 is deprecated because it has critical bugs.
4.25.115.121 241 6 months ago 4.25.115.121 is deprecated because it has critical bugs.
4.25.114.172 257 6 months ago 4.25.114.172 is deprecated because it has critical bugs.
4.25.109.111 263 6 months ago 4.25.109.111 is deprecated because it has critical bugs.
4.25.108.182 265 6 months ago 4.25.108.182 is deprecated because it has critical bugs.
4.25.108.160 272 6 months ago 4.25.108.160 is deprecated because it has critical bugs.
4.25.1.1 289 7 months ago 4.25.1.1 is deprecated because it has critical bugs.
3.24.1224.141 272 7 months ago 3.24.1224.141 is deprecated because it has critical bugs.
3.24.1216.116 294 7 months ago 3.24.1216.116 is deprecated because it has critical bugs.
3.24.1206.100 276 7 months ago 3.24.1206.100 is deprecated because it has critical bugs.
3.24.1205.171 281 7 months ago 3.24.1205.171 is deprecated because it has critical bugs.
3.24.1202.150 282 8 months ago 3.24.1202.150 is deprecated because it has critical bugs.
3.24.1126.231 280 8 months ago 3.24.1126.231 is deprecated because it has critical bugs.
3.24.1126.172 280 8 months ago 3.24.1126.172 is deprecated because it has critical bugs.
3.24.1126.114 286 8 months ago 3.24.1126.114 is deprecated because it has critical bugs.
3.24.1126.104 280 8 months ago 3.24.1126.104 is deprecated because it has critical bugs.
3.24.1125.181 262 8 months ago 3.24.1125.181 is deprecated because it has critical bugs.
3.24.1125.104 280 8 months ago 3.24.1125.104 is deprecated because it has critical bugs.
3.24.1121.183 269 8 months ago 3.24.1121.183 is deprecated because it has critical bugs.
3.24.1120.183 274 8 months ago 3.24.1120.183 is deprecated because it has critical bugs.
3.24.1119.31 271 8 months ago 3.24.1119.31 is deprecated because it has critical bugs.
3.24.1115.143 264 8 months ago 3.24.1115.143 is deprecated because it has critical bugs.
3.24.1113.100 280 8 months ago 3.24.1113.100 is deprecated because it has critical bugs.
3.24.1112.125 282 8 months ago 3.24.1112.125 is deprecated because it has critical bugs.
3.24.1107.140 277 8 months ago 3.24.1107.140 is deprecated because it has critical bugs.
3.24.1107.54 272 8 months ago 3.24.1107.54 is deprecated because it has critical bugs.
3.24.1107.34 271 8 months ago 3.24.1107.34 is deprecated because it has critical bugs.
3.24.1105.111 271 8 months ago 3.24.1105.111 is deprecated because it has critical bugs.
3.24.1103.31 285 8 months ago 3.24.1103.31 is deprecated because it has critical bugs.
3.24.1103 280 8 months ago 3.24.1103 is deprecated because it has critical bugs.
3.24.1031.135 274 9 months ago 3.24.1031.135 is deprecated because it has critical bugs.
3.24.1031.112 270 9 months ago 3.24.1031.112 is deprecated because it has critical bugs.
3.24.1031.104 271 9 months ago 3.24.1031.104 is deprecated because it has critical bugs.
3.24.1029.142 279 9 months ago 3.24.1029.142 is deprecated because it has critical bugs.
3.24.1025.30 279 9 months ago 3.24.1025.30 is deprecated because it has critical bugs.
3.24.1022.142 267 9 months ago 3.24.1022.142 is deprecated because it has critical bugs.
3.24.1018.204 330 9 months ago 3.24.1018.204 is deprecated because it has critical bugs.
3.24.1018.175 318 9 months ago 3.24.1018.175 is deprecated because it has critical bugs.
3.24.1018.166 322 9 months ago 3.24.1018.166 is deprecated because it has critical bugs.
3.24.1018.93 329 9 months ago 3.24.1018.93 is deprecated because it has critical bugs.
3.24.1017.42 276 9 months ago 3.24.1017.42 is deprecated because it has critical bugs.
3.24.1016.161 279 9 months ago 3.24.1016.161 is deprecated because it has critical bugs.
3.24.1015.231 277 9 months ago 3.24.1015.231 is deprecated because it has critical bugs.
3.24.1015.14 281 9 months ago 3.24.1015.14 is deprecated because it has critical bugs.
3.24.1012.114 278 9 months ago 3.24.1012.114 is deprecated because it has critical bugs.
3.24.1009.115 285 9 months ago 3.24.1009.115 is deprecated because it has critical bugs.
3.24.1008.160 273 9 months ago 3.24.1008.160 is deprecated because it has critical bugs.
3.24.1008.133 283 9 months ago 3.24.1008.133 is deprecated because it has critical bugs.
3.24.1007.185 282 9 months ago 3.24.1007.185 is deprecated because it has critical bugs.
3.24.1003.33 285 9 months ago 3.24.1003.33 is deprecated because it has critical bugs.
3.24.1002.162 278 10 months ago 3.24.1002.162 is deprecated because it has critical bugs.
3.24.929.143 278 10 months ago 3.24.929.143 is deprecated because it has critical bugs.
3.24.929.141 282 10 months ago 3.24.929.141 is deprecated because it has critical bugs.
3.24.929.131 279 10 months ago 3.24.929.131 is deprecated because it has critical bugs.
3.24.929.122 286 10 months ago 3.24.929.122 is deprecated because it has critical bugs.
3.24.926.184 277 10 months ago 3.24.926.184 is deprecated because it has critical bugs.
3.24.926.182 277 10 months ago 3.24.926.182 is deprecated because it has critical bugs.
3.24.926.175 284 10 months ago 3.24.926.175 is deprecated because it has critical bugs.
3.24.924.160 279 10 months ago 3.24.924.160 is deprecated because it has critical bugs.
3.24.924.133 289 10 months ago 3.24.924.133 is deprecated because it has critical bugs.
3.24.924.124 279 10 months ago 3.24.924.124 is deprecated because it has critical bugs.
3.24.924.10 282 10 months ago 3.24.924.10 is deprecated because it has critical bugs.
3.24.924.1 279 10 months ago 3.24.924.1 is deprecated because it has critical bugs.
3.24.923.234 274 10 months ago 3.24.923.234 is deprecated because it has critical bugs.
3.24.923.232 273 10 months ago 3.24.923.232 is deprecated because it has critical bugs.
3.24.923.155 282 10 months ago 3.24.923.155 is deprecated because it has critical bugs.
3.24.919.92 292 10 months ago 3.24.919.92 is deprecated because it has critical bugs.
3.24.914.125 296 9/14/2024 3.24.914.125 is deprecated because it has critical bugs.
3.24.914.115 279 9/14/2024 3.24.914.115 is deprecated because it has critical bugs.
3.24.914.111 276 9/14/2024 3.24.914.111 is deprecated because it has critical bugs.
3.24.911.95 281 9/11/2024 3.24.911.95 is deprecated because it has critical bugs.
3.24.908.215 270 9/8/2024 3.24.908.215 is deprecated because it has critical bugs.
3.24.904.200 276 9/4/2024 3.24.904.200 is deprecated because it has critical bugs.
3.24.828.163 283 8/28/2024 3.24.828.163 is deprecated because it has critical bugs.
3.24.820.173 295 8/20/2024 3.24.820.173 is deprecated because it has critical bugs.
3.24.814.92 294 8/14/2024 3.24.814.92 is deprecated because it has critical bugs.
3.24.812.115 293 8/12/2024 3.24.812.115 is deprecated because it has critical bugs.
3.24.802.100 267 8/2/2024 3.24.802.100 is deprecated because it has critical bugs.
3.24.801.162 278 8/1/2024 3.24.801.162 is deprecated because it has critical bugs.
3.24.801.160 272 8/1/2024 3.24.801.160 is deprecated because it has critical bugs.
3.24.801.155 273 8/1/2024 3.24.801.155 is deprecated because it has critical bugs.
3.24.730.164 270 7/30/2024 3.24.730.164 is deprecated because it has critical bugs.
3.24.730.91 262 7/30/2024 3.24.730.91 is deprecated because it has critical bugs.
3.24.724.91 268 7/24/2024 3.24.724.91 is deprecated because it has critical bugs.
3.24.718.105 286 7/18/2024 3.24.718.105 is deprecated because it has critical bugs.
3.24.716.95 297 7/16/2024 3.24.716.95 is deprecated because it has critical bugs.
3.24.712.94 277 7/12/2024 3.24.712.94 is deprecated because it has critical bugs.
3.24.710.14 282 7/9/2024 3.24.710.14 is deprecated because it has critical bugs.
3.24.709.105 278 7/9/2024 3.24.709.105 is deprecated because it has critical bugs.
3.24.704.94 280 7/4/2024 3.24.704.94 is deprecated because it has critical bugs.
3.24.701.90 289 7/1/2024 3.24.701.90 is deprecated because it has critical bugs.
3.24.628.114 286 6/28/2024 3.24.628.114 is deprecated because it has critical bugs.
3.24.627.145 277 6/27/2024 3.24.627.145 is deprecated because it has critical bugs.
3.24.620.160 285 6/20/2024 3.24.620.160 is deprecated because it has critical bugs.
3.24.613.115 280 6/13/2024 3.24.613.115 is deprecated because it has critical bugs.
3.24.612.95 283 6/12/2024 3.24.612.95 is deprecated because it has critical bugs.
3.24.528.90 275 5/28/2024 3.24.528.90 is deprecated because it has critical bugs.
3.24.522.84 290 5/22/2024 3.24.522.84 is deprecated because it has critical bugs.
3.24.512.213 285 5/12/2024 3.24.512.213 is deprecated because it has critical bugs.
3.24.508.112 290 5/8/2024 3.24.508.112 is deprecated because it has critical bugs.
2.2024.428.71 283 4/28/2024 2.2024.428.71 is deprecated because it has critical bugs.
2.2.72 357 4/14/2024 2.2.72 is deprecated because it has critical bugs.
2.2.71 281 4/12/2024 2.2.71 is deprecated because it has critical bugs.
2.2.6 287 4/10/2024 2.2.6 is deprecated because it has critical bugs.
2.2.5 296 3/26/2024 2.2.5 is deprecated because it has critical bugs.
2.2.4 295 3/25/2024 2.2.4 is deprecated because it has critical bugs.
2.2.3 296 3/24/2024 2.2.3 is deprecated because it has critical bugs.
2.2.2 299 3/21/2024 2.2.2 is deprecated because it has critical bugs.
2.2.1 294 3/20/2024 2.2.1 is deprecated because it has critical bugs.
2.2.0 300 3/13/2024 2.2.0 is deprecated because it has critical bugs.
2.1.9 304 2/21/2024 2.1.9 is deprecated because it has critical bugs.
2.1.8 308 2/18/2024 2.1.8 is deprecated because it has critical bugs.
2.1.7 299 2/16/2024 2.1.7 is deprecated because it has critical bugs.
2.1.6 306 2/14/2024 2.1.6 is deprecated because it has critical bugs.
2.1.5 304 2/14/2024 2.1.5 is deprecated because it has critical bugs.
2.1.4 303 2/9/2024 2.1.4 is deprecated because it has critical bugs.
2.1.3 300 2/8/2024 2.1.3 is deprecated because it has critical bugs.
2.1.2 303 2/5/2024 2.1.2 is deprecated because it has critical bugs.
2.1.1.2 360 12/26/2023 2.1.1.2 is deprecated because it has critical bugs.
2.1.1.1 302 12/26/2023 2.1.1.1 is deprecated because it has critical bugs.
2.1.1 303 12/25/2023 2.1.1 is deprecated because it has critical bugs.
2.1.0 324 12/17/2023 2.1.0 is deprecated because it has critical bugs.
2.0.11 309 12/6/2023 2.0.11 is deprecated because it has critical bugs.
2.0.1 307 11/15/2023 2.0.1 is deprecated because it has critical bugs.
2.0.0 287 11/14/2023 2.0.0 is deprecated because it has critical bugs.
1.9.1 310 11/1/2023 1.9.1 is deprecated because it has critical bugs.
1.9.0 303 10/19/2023 1.9.0 is deprecated because it has critical bugs.
1.9.0-preview2 293 10/12/2023 1.9.0-preview2 is deprecated because it has critical bugs.
1.9.0-preview1 279 10/12/2023 1.9.0-preview1 is deprecated because it has critical bugs.
1.8.9 313 10/11/2023 1.8.9 is deprecated because it has critical bugs.
1.8.8 309 10/11/2023 1.8.8 is deprecated because it has critical bugs.
1.8.7-rc2 286 9/21/2023 1.8.7-rc2 is deprecated because it has critical bugs.
1.8.7-rc1 289 9/12/2023 1.8.7-rc1 is deprecated because it has critical bugs.
1.8.6 335 8/31/2023 1.8.6 is deprecated because it has critical bugs.
1.8.5 313 8/25/2023 1.8.5 is deprecated because it has critical bugs.
1.8.4 314 8/24/2023 1.8.4 is deprecated because it has critical bugs.
1.8.3 317 8/23/2023 1.8.3 is deprecated because it has critical bugs.
1.8.2 383 8/22/2023 1.8.2 is deprecated because it has critical bugs.
1.8.1 308 8/18/2023 1.8.1 is deprecated because it has critical bugs.