using Microsoft.Extensions.Logging; public class MyClass { private readonly ILoggerIn this example, we have defined a MyClass that depends on ILogger. The constructor of MyClass takes ILogger_logger; public MyClass(ILogger logger) { _logger = logger; } public void SomeMethod() { _logger.LogInformation("Some message"); } }