MySqlConnector icon indicating copy to clipboard operation
MySqlConnector copied to clipboard

Switch to Microsoft.Extensions.Logging

Open bgrainger opened this issue 3 years ago • 1 comments
trafficstars

MySqlConnector currently implements logging via a custom interface: https://github.com/mysql-net/MySqlConnector/issues/390

Npgsql is planning to replace their custom logging interface with Microsoft.Extensions.Logging (https://github.com/npgsql/npgsql/issues/2103#issuecomment-997813520):

Looking at this again, we should really consider switching to Microsoft.Extensions.Logging - there isn't any reason not to do that any more:

  • It's the de-facto standard library in the .NET ecosystem
  • It's definitely high-perf (used in ASP.NET itself), there's even new source generation support in .NET 6.0.
  • It allows effortless logging to a wide variety of destinations; with Npgsql's custom logging, adapters need to be coded up manually every time.
  • The only drawback I can think of is having to reference Microsoft.Extensions.Logging.Abstractions, which I don't love, but I think it makes sense at this point.

All those advantages (and the drawback) are the same for MySqlConnector, and I reach the same conclusion: it's time to switch.

I assume this would be a source+binary breaking change, so it would go in the next major version.

bgrainger avatar Jan 02 '22 19:01 bgrainger

DbDataSource (https://github.com/dotnet/runtime/issues/64812) could allow the ILoggerFactory to be specified.

bgrainger avatar Feb 13 '22 22:02 bgrainger