File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
src/main/java/com/uid2/shared/audit Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,27 @@ public JsonObject toJson() {
5555 .put ("method" , method )
5656 .put ("endpoint" , endpoint )
5757 .put ("trace_id" , traceId )
58+ .put ("uid_instance_id" , uidInstanceId )
5859 .put ("actor" , actor );
5960 if (uidTraceId != null ) {
6061 json .put ("uid_trace_id" , uidTraceId );
6162 }
62- if (uidInstanceId != null ) {
63- json .put ("uid_instance_id" , uidInstanceId );
64- }
63+ actor .put ("id" , this .getLogIdentifier (json ));
64+ json .put ("actor" , actor );
6565 if (queryParams != null ) json .put ("query_params" , queryParams );
6666 if (requestBody != null ) json .put ("request_body" , requestBody );
6767 return json ;
6868 }
6969
70+ private String getLogIdentifier (JsonObject logObject ) {
71+ JsonObject actor = logObject .getJsonObject ("actor" );
72+ String email = (actor != null ) ? actor .getString ("email" ) : null ;
73+ if (email != null && !email .isEmpty ()) {
74+ return email ;
75+ }
76+ return logObject .getString ("uid_instance_id" );
77+ }
78+
7079 @ Override
7180 public String toString () {
7281 return toJson ().encode ();
You can’t perform that action at this time.
0 commit comments