AppCenter for Microsoft.Extensions.Logging

The AppCenter library can be used without any other Shiny module or wiring. It only requires the standing Microsoft.Logging.Extensions wiring with appbuilder.Logging.AddAppCenter("");

Setup

Registering in MAUI


  using Shiny;

  namespace ShinyApp;
  
  
  public static class MauiProgram
  {
      public static MauiApp CreateMauiApp() 
      {
        var builder = MauiApp
          .CreateBuilder()
          .UseMauiApp<App>()
          .UseShiny() // <-- add this line (this is important)
          .ConfigureFonts(fonts =>
          {
              fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
              fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
          });


      #if !MACCATALYST
      builder.Logging.AddAppCenter("YourAppCenterKey");
      #endif
      
      return builder.Build();
    }
  }

Using

Within any component that has been registered with your dependency injection container, you can now do the following

using Microsoft.Logging.Extensions;

namespace MyNamespace;

public class MyThing {

    public MyThing(ILogger<MyThing> logger)
    {
        logger.LogInformation("Hello World");
    }
}