Skip to content

Logging

Elvin (Tharindu) Thudugala edited this page Aug 3, 2022 · 1 revision

From Version 10.0.0 and above

You can set ILogger to monitor internal logs

For example, you can use DebugLoggerProvider by Microsoft.Extensions.Logging.Debug

.Net MAUI

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
			...
			.UseLocalNotification();

        		builder.Services.AddLogging(logging =>
        		{
            			logging.AddDebug();
        		});

        	return builder.Build();
	}
}

Xamarin.Forms

 public partial class App : Application
    {
        public App()
        {
            InitializeComponent();

            MainPage = new NavigationPage(new MainPage());

            LocalNotificationCenter.Logger = new DebugLoggerProvider().CreateLogger("LocalNotification.Sample");            
        }        
    }