BabelReportingExtensions

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

A babel reporting extensions.

public static class BabelReportingExtensions

Inheritance

objectBabelReportingExtensions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Methods

SendExceptionReport(BabelReporting, string, Exception)

Sends an exception report to the BabelReporting service.

public static SendReportResult SendExceptionReport(this BabelReporting self, string userKey, Exception error)

Parameters

NameDescription

The BabelReporting instance.

userKey string

The license user key.

error Exception

The exception to be reported.

Returns

NameDescription

The send report operation result .

SendExceptionReportAsync(BabelReporting, string, Exception, CancellationToken)

Sends an exception report asynchronously to the BabelReporting service.

public static Task<SendReportResult> SendExceptionReportAsync(this BabelReporting self, string userKey, Exception error, CancellationToken cancellationToken = default)

Parameters

NameDescription

The BabelReporting instance.

userKey string

The license user key.

error Exception

The exception to be reported.

cancellationToken CancellationToken

(Optional) A token that allows processing to be cancelled.

Returns

NameDescription

A task representing the asynchronous operation that returns a .

Examples

BabelReporting reporting = new BabelReporting();

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

	// If you want to encrypt the report, set the password here
	// This is the same password configured in Babel Licensing Service to decrypt 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"));

SendLicenseReport(BabelReporting, string)

A BabelReporting extension method that sends a license usage report.

public static SendReportResult SendLicenseReport(this BabelReporting self, string userKey)

Parameters

NameDescription

The self to act on.

userKey string

The license user key.

Returns

NameDescription

The send report operation result .

SendLicenseReportAsync(BabelReporting, string, CancellationToken)

A BabelReporting extension method that sends a license usage report asynchronous.

public static Task<SendReportResult> SendLicenseReportAsync(this BabelReporting self, string userKey, CancellationToken cancellationToken = default)

Parameters

NameDescription

The self to act on.

userKey string

The license user key.

cancellationToken CancellationToken

(Optional) A token that allows processing to be cancelled.

Returns

NameDescription

An asynchronous result that yields the send license usage report.

Last updated