Add EF Core-style logging for bulk insert operations#103
Conversation
…and log messages Agent-Logs-Url: https://github.com/PhenX/PhenX.EntityFrameworkCore.BulkInsert/sessions/481b78be-69b9-450e-b8b4-3c7176838952 Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds EF Core-style structured logging around bulk insert operations (timing + auxiliary SQL debug logs) and updates DI/service lifetimes so logging can be resolved correctly from EF Core’s internal service provider.
Changes:
- Introduces new
LoggerMessagedefinitions for bulk insert timing (Info) and auxiliary SQL command execution (Debug). - Wraps bulk insert and internal SQL execution with
Stopwatchtiming and emits the new log events. - Switches provider construction to use
ILoggerFactoryand changesIBulkInsertProviderregistration to scoped; adds a fallbackNullLoggerFactory.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PhenX.EntityFrameworkCore.BulkInsert.Tests/Tests/Logging/LoggingTests.cs | Adds tests asserting the new logging events are emitted for SQLite bulk insert paths. |
| tests/PhenX.EntityFrameworkCore.BulkInsert.Tests/Tests/Logging/CapturingLogger.cs | Adds a small logger/provider to capture log entries in tests. |
| src/PhenX.EntityFrameworkCore.BulkInsert/Log.cs | Adds event IDs 1004/1005 with structured message templates. |
| src/PhenX.EntityFrameworkCore.BulkInsert/BulkInsertProviderBase.cs | Adds timing + log emission for bulk insert and auxiliary SQL execution; switches to ILoggerFactory. |
| src/PhenX.EntityFrameworkCore.BulkInsert/BulkInsertOptionsExtension.cs | Updates service registration to scoped provider + ILoggerFactory fallback. |
| src/PhenX.EntityFrameworkCore.BulkInsert.SqlServer/SqlServerBulkInsertProvider.cs | Updates ctor to accept ILoggerFactory. |
| src/PhenX.EntityFrameworkCore.BulkInsert.Sqlite/SqliteBulkInsertProvider.cs | Updates ctor to accept ILoggerFactory. |
| src/PhenX.EntityFrameworkCore.BulkInsert.PostgreSql/PostgreSqlBulkInsertProvider.cs | Updates ctor to accept ILoggerFactory. |
| src/PhenX.EntityFrameworkCore.BulkInsert.Oracle/OracleBulkInsertProvider.cs | Updates ctor to accept ILoggerFactory. |
| src/PhenX.EntityFrameworkCore.BulkInsert.MySql/MySqlBulkInsertProvider.cs | Updates ctor to accept ILoggerFactory. |
|
@copilot apply code review suggestions |
Agent-Logs-Url: https://github.com/PhenX/PhenX.EntityFrameworkCore.BulkInsert/sessions/50f8adc9-2589-4b71-a87e-14db3ec99af9 Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
Applied the requested review fixes in commit 2391791: updated bulk-insert timing log to use the actual executed table name, disposed DbCommand in ExecuteAsync, and disposed DbContext instances in logging tests. There are no UI changes in this PR, so no screenshot applies. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot update the docs accordingly, and update the copilot instructions : to always update the docs when the public API changes, the README when notables changes are added, or modified, and to update the tests |
Agent-Logs-Url: https://github.com/PhenX/PhenX.EntityFrameworkCore.BulkInsert/sessions/056ca3a1-0d57-424f-a270-daf8457b20bd Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
Done in commit efb336b. I updated the docs (README and docs/documentation.md) with the new logging behavior and event IDs, and updated .github/copilot-instructions.md to require updating docs for public API changes, README for notable feature/behavior changes, and tests for behavior changes. There are no UI changes in this PR, so no screenshot applies. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Uh oh!
There was an error while loading. Please reload this page.