Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Serilog sink that writes events to Xamarin mobile targets

License

NotificationsYou must be signed in to change notification settings

serilog/serilog-sinks-xamarin

Repository files navigation

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

Getting started

Install fromNuGet:

Install-Package Serilog.Sinks.Xamarin

When using Xamarin.iOS

Log.Logger=newLoggerConfiguration().WriteTo.NSLog().CreateLogger();

When using Xamarin.Android

Log.Logger=newLoggerConfiguration().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 callLog.CloseAndFlush() orLogger.Dispose() when the application/activity exits.


[8]ページ先頭

©2009-2025 Movatter.jp