Skip to content

Instantly share code, notes, and snippets.

@niemyjski
Last active August 29, 2015 14:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niemyjski/b59dc1be3778ecc67d8e to your computer and use it in GitHub Desktop.
Save niemyjski/b59dc1be3778ecc67d8e to your computer and use it in GitHub Desktop.
Exceptionless Plugin Example
// 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