Last active
August 29, 2015 14:15
-
-
Save niemyjski/b59dc1be3778ecc67d8e to your computer and use it in GitHub Desktop.
Exceptionless Plugin Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There are two ways to create an plugin: | |
public class UniqueUserIdentifierPlugin : IEventPlugin { | |
public void Run(EventPluginContext context) { | |
if (!ctx.Client.Configuration.IncludePrivateInformation) | |
return; | |
// Only update it if it's not currently set. | |
var user = context.Event.GetUserIdentity(); | |
if (user != null) | |
return; | |
//context.Event.SetUserIdentity("unique user identifier"); | |
// or | |
context.Event.SetUserIdentity("unique user identifier", "user friendly name"); | |
} | |
} | |
// You'd then register it with | |
ExceptionlessClient.Default.Configuration.AddPlugin<UniqueUserIdentifierPlugin>(); | |
// The second way would be to use an action. | |
ExceptionlessClient.Default.Configuration.AddPlugin(context => { | |
if (!context.Client.Configuration.IncludePrivateInformation) | |
return; | |
// Only update it if it's not currently set. | |
var user = context.Event.GetUserIdentity(); | |
if (user != null) | |
return; | |
//context.Event.SetUserIdentity("unique user identifier"); | |
// or | |
context.Event.SetUserIdentity("unique user identifier", "user friendly name"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment