Skip to content

nikolajskov/LoggingPlugin

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

Logging Plugin for Xamarin

Logging Plugin for Xamarin provides a consistent, cross platform logging plugin for Xamarin.iOS, Xamarin.Android and Xamarin.Forms.

NuGet

Xam.Plugins.Logging NuGet

How to use

From your Xamarin.Android, Xamarin.iOS or shared .NET Standard project simply call the static logging method corresponding to the desired severity.

using Plugin.Logging;

Logging.Verbose("Verbose message");
Logging.Verbose("Verbose message", "Tag");

Logging.Debug("Debug message");
Logging.Debug("Debug message", "Tag"));

Logging.Info("Info message");
Logging.Info("Info message", "Tag");

Logging.Warning("Warning message");
Logging.Warning("Warning message", "Tag");
Logging.Warning("Warning message", new System.Exception("Exception message"));
Logging.Warning("Warning message", "Tag", new System.Exception("Exception message"));

Logging.Error("Error message");
Logging.Error("Error message", "Tag");
Logging.Error("Error message", new System.Exception("Exception message"));
Logging.Error("Error message", "Tag", new System.Exception("Exception message"));

Android

Log messages will be written using the Android.Util.Log class. The plugin can optionally be initialized by calling the static Init() method where a general tag and severity filtering can be supplied.

using Plugin.Logging;

Logging.Init("AndroidTag");

Logging.Verbose("Verbose message"); // Using the general 'AndroidTag'
Logging.Verbose("Verbose message", "Some other Tag"); // Using specific tag

iOS

Log messages will be written to the Apple System Log facility using NSLog with the format

$"{tag}: {severity}: {message}\n{exception.Message}"

The plugin can optionally be initialized by calling the static Init() method where a general tag and severity filtering can be supplied.

Logging.Init("iOSTag");

Logging.Verbose("Verbose message"); // Using the general 'AndroidTag'
Logging.Verbose("Verbose message", "Some other Tag"); // Using specific tag

About

Logging Plugin for Xamarin provides a consistent, cross platform logging plugin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages