/ChilliSource.Mobile.Logging

Logging framework for ChilliSource.Mobile

Primary LanguageC#MIT LicenseMIT

License: MIT Built With C#

ChilliSource.Mobile.Logging

This project is part of the ChilliSource framework developed by BlueChilli.

Summary

This library provides a Raygun logging sink and Serilog based logging extensions and helper classes to simplify the instantiation and usage of Serilog logging functionality.

Usage

Initialization

You need to first create a LoggerConfiguration instance and specify the type of logging sink that receives the logged data. Currently ChilliSource.Mobile.Logging only provides a Raygun sink, however you can add additional sinks if you wish.

var config = new LoggerConfiguration()
    .MinimumLevel.Verbose()
    .WriteTo.Raygun("RaygunAPIKey");

Then create the logger from the configuration:

ILogger logger = config.BuildLogger();

Logging

You can now use the logger to capture errors, warnings, information, and debugging data:

logger?.Error(ex, message);
logger?.Warning(message);
logger?.Information(message);
logger?.Debug(message);

Logging within ChilliSource.Mobile

The ChilliSource.Mobile frameworks perform their own logging using the ILogger interface (available in ChilliSource.Mobile.Core).

In order to let the frameworks log their data, simply create a new logger as outlined above and pass it as a parameter to one of the relevant methods or constructors.

For example, to use Raygun logging for the BeaconService in ChilliSource.Mobile.IoT.Beacons framework, write the following code:

var logger = new LoggerConfiguration()
    .MinimumLevel.Verbose()
    .WriteTo.Raygun("RaygunAPIKey")
    .BuildLogger();

var beaconService = DependencyService.Get<IBeaconService>();    
beaconService.InitializeService(BeaconMonitoringType.RegionMonitoring, logger);

Installation

The library is available via NuGet here.

Releases

See the releases.

Contribution

Please see the Contribution Guide.

License

ChilliSource.Mobile is licensed under the MIT license.

Feedback and Contact

For questions or feedback, please contact chillisource@bluechilli.com.