MetroLog is working very well for the pages but I tried to use the code in the example in my service or ViewModel class
private static readonly ILogger Log = LoggerFactory.GetLogger(nameof(DownloadService));
log
is always null
. Using the dependency injection, I can’t have my code running. For example, I have this class
public partial class ArticleService : RestServiceBase
{
public ArticleService(IdentityService identityService) : base()
{
}
}
that it is based on this one
public class RestServiceBase
{
protected RestServiceBase()
{
}
}
In my MauiPrograg.cs I use the dependency injection like:
builder.Services.AddScoped(sp => new ArticleService(sp.GetRequiredService<IdentityService>()));
but I can’t find how to pass an instance of the MetroLog.