BabelReporting

Namespace: Babel.Licensing Assembly: Babel.Licensing.dll

A babel report service client. This class cannot be inherited.

public sealed class BabelReporting : BabelService, IDisposable

Inheritance

objectBabelServiceBabelReporting

Implements

IDisposable

Inherited Members

BabelService.Dispose(), BabelService.ShutdownAsync(), BabelService.Configuration, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Extension Methods

BabelReportingExtensions.SendExceptionReport(BabelReporting, string, Exception), BabelReportingExtensions.SendExceptionReportAsync(BabelReporting, string, Exception, CancellationToken), BabelReportingExtensions.SendLicenseReport(BabelReporting, string), BabelReportingExtensions.SendLicenseReportAsync(BabelReporting, string, CancellationToken)

Examples

BabelReporting reporting = new BabelReporting();

BabelReporting.Configure(config => {
    // Set the service URL
    ServiceUrl = "http://localhost:5005",

	// Set the password used to encrypt the report
    config.EncryptionKey = "my custom encryption key";

	// Whether to collect the process information
    config.ExceptionReportOptions.Environment.CollectProcessInformation = true;
});

// Add report custom properties
reporting.BeforeSendReport += (s, e) => {                
	e.Report.Properties.Add("my_custom_property", "my custom value");
};

// Send the report
// User key can be obtained from the Babel Licensing service
string userKey = "user key here";
reporting.SendExceptionReport(userKey, new Exception("test exception"));

Constructors

BabelReporting()

Default constructor.

public BabelReporting()

BabelReporting(BabelReportingConfiguration)

BabelReporting class constructor.

public BabelReporting(BabelReportingConfiguration configuration)

Parameters

NameDescription

The configuration

Properties

Configuration

Reporting configuration

public BabelReportingConfiguration Configuration { get; }

Property Value

BabelReportingConfiguration

Methods

Configure(Action<BabelReportingConfiguration>)

Configures the BabelReporting service

public static void Configure(Action<BabelReportingConfiguration> configurer)

Parameters

NameDescription

CreateDefaultConfiguration()

Creates default service configuration

protected override BabelServiceConfiguration CreateDefaultConfiguration()

Returns

NameDescription

An instance of class

Dispose(bool)

Dispose method

protected override void Dispose(bool disposing)

Parameters

NameDescription

Whether is disposing or finalizing.

OnConfiguring(BabelServiceConfiguration)

Called on server configuration

protected override void OnConfiguring(BabelServiceConfiguration config)

Parameters

NameDescription

The babel service configuration.

Send(string, Report)

Sends a report to the Babel server

public SendReportResult Send(string userKey, Report report)

Parameters

NameDescription

The license user key.

The report object.

Returns

NameDescription

The SendReportResult object.

Exceptions

NameDescription

SendAsync(string, Report, CancellationToken)

Sends a report asynchronously to the Babel server

public Task<SendReportResult> SendAsync(string userKey, Report report, CancellationToken cancellationToken = default)

Parameters

NameDescription

The license user key.

The report object.

(Optional)The operation cancel token.

Returns

NameDescription

The SendReportResult object.

Exceptions

NameDescription

AfterSendReport

Event queue for all listeners interested in AfterSendReport events.

public event EventHandler<AfterSendReportEventArgs> AfterSendReport

Event Type

EventHandler<AfterSendReportEventArgs>

BeforeSendReport

Event queue for all listeners interested in BeforeSendReport events.

public event EventHandler<BeforeSendReportEventArgs> BeforeSendReport

Event Type

EventHandler<BeforeSendReportEventArgs>

Last updated