code: func createAuditEventAndAttachToContext(req *http.Request, policy policy.Checker) (*http.Request, *auditinternal.Event, []auditinternal.Stage, error) {
  	ctx := req.Context()
  
  	attribs, err := GetAuthorizerAttributes(ctx)
  	if err != nil {
  		return req, nil, nil, fmt.Errorf("failed to GetAuthorizerAttributes: %v", err)
  	}
  
  	level, omitStages := policy.LevelAndStages(attribs)
  	audit.ObservePolicyLevel(level)
  	if level == auditinternal.LevelNone {
  		// Don't audit.
  		return req, nil, nil, nil
  	}
  
  	ev, err := audit.NewEventFromRequest(req, level, attribs)
  	if err != nil {
  		return req, nil, nil, fmt.Errorf("failed to complete audit event from request: %v", err)
  	}
  
  	req = req.WithContext(request.WithAuditEvent(ctx, ev))
  
  	return req, ev, omitStages, nil
  }
docs: // createAuditEventAndAttachToContext is responsible for creating the audit event
  // and attaching it to the appropriate request context. It returns:
  // - context with audit event attached to it
  // - created audit event
  // - error if anything bad happened