A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/serilog/serilog-sinks-Xamarin below:

serilog/serilog-sinks-xamarin: A Serilog sink that writes events to Xamarin mobile targets

Writes Serilog events to the console of Xamarin.iOS (NSLog) / Xamarin.Android (AndroidLog).

Install from NuGet:

Install-Package Serilog.Sinks.Xamarin

When using Xamarin.iOS

Log.Logger = new LoggerConfiguration()
    .WriteTo.NSLog()
    .CreateLogger();

When using Xamarin.Android

Log.Logger = new LoggerConfiguration()
    .WriteTo.AndroidLog()
    .Enrich.WithProperty(Constants.SourceContextPropertyName, "MyCustomTag") //Sets the Tag field.
    .CreateLogger();

Within your portable class libary or within your application

Log.Information("This will be written to either NSLog or AndroidLog");

Because the memory buffer may contain events that have not yet been written to the target sink, it is important to call Log.CloseAndFlush() or Logger.Dispose() when the application/activity exits.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4