I want to add a method to the existing LoggerExtensions on Core 2.1 that will need to use IConfiguration to read some settings from the appsettings.json file.
I created a partial static class with my new method inside it but this does not allow me to access the IConfiguration as it is a static class.
How could I create this new method that is part of LoggerExtensions that can read from IConfiguration?
In the example below I can't access _configuration.GetSection as I can not inject it
public static partial class LoggerExtensions { public static void EmailError(this ILogger logger, Exception exception, string message) { using (var smtpClient = new SmtpClient(config.GetSection("Host").Value)) { // ...... } } }