@@ -33,7 +33,41 @@ public static void SetVersion(this ExceptionlessConfiguration config, Version ve
33
33
34
34
config . DefaultData [ Event . KnownDataKeys . Version ] = version . ToString ( ) ;
35
35
}
36
-
36
+
37
+ /// <summary>
38
+ /// Automatically set the user identity (ie. email address, username, user id) on events.
39
+ /// </summary>
40
+ /// <param name="config">The configuration object</param>
41
+ /// <param name="identity">The user's identity that the event happened to.</param>
42
+ public static void SetUserIdentity ( this ExceptionlessConfiguration config , string identity ) {
43
+ config . SetUserIdentity ( identity , null ) ;
44
+ }
45
+
46
+ /// <summary>
47
+ /// Automatically set the user identity (ie. email address, username, user id) on events.
48
+ /// </summary>
49
+ /// <param name="config">The configuration object</param>
50
+ /// <param name="identity">The user's identity that the event happened to.</param>
51
+ /// <param name="name">The user's friendly name that the event happened to.</param>
52
+ public static void SetUserIdentity ( this ExceptionlessConfiguration config , string identity , string name ) {
53
+ if ( String . IsNullOrWhiteSpace ( identity ) && String . IsNullOrWhiteSpace ( name ) )
54
+ return ;
55
+
56
+ config . DefaultData [ Event . KnownDataKeys . UserInfo ] = new UserInfo ( identity , name ) ;
57
+ }
58
+
59
+ /// <summary>
60
+ /// Automatically set the user identity (ie. email address, username, user id) on events.
61
+ /// </summary>
62
+ /// <param name="config">The configuration object</param>
63
+ /// <param name="userInfo">The user's identity that the event happened to.</param>
64
+ public static void SetUserIdentity ( this ExceptionlessConfiguration config , UserInfo userInfo ) {
65
+ if ( userInfo == null )
66
+ return ;
67
+
68
+ config . DefaultData [ Event . KnownDataKeys . UserInfo ] = userInfo ;
69
+ }
70
+
37
71
public static string GetQueueName ( this ExceptionlessConfiguration config ) {
38
72
return ! String . IsNullOrEmpty ( config . ApiKey ) ? config . ApiKey . Substring ( 0 , 8 ) : null ;
39
73
}
0 commit comments