private void SetupAiLogger( AiConfig aiConfig, IOrganizationService service, ITracingService tracingService, IExecutionContext executionContext, int?pluginStage, int?workflowCategory) { this._instrumentationKey = aiConfig.InstrumentationKey; this._loggingEndpoint = aiConfig.AiEndpoint; this._disableTraceTracking = aiConfig.DisableTraceTracking; this._disableExceptionTracking = aiConfig.DisableExceptionTracking; this._disableDependencyTracking = aiConfig.DisableDependencyTracking; this._disableEventTracking = aiConfig.DisableEventTracking; this._disableMetricTracking = aiConfig.DisableMetricTracking; this._enableDebug = aiConfig.EnableDebug; this._percentLoggedTrace = aiConfig.PercentLoggedTrace; this._percentLoggedMetric = aiConfig.PercentLoggedMetric; this._percentLoggedEvent = aiConfig.PercentLoggedEvent; this._percentLoggedException = aiConfig.PercentLoggedException; this._percentLoggedDependency = aiConfig.PercentLoggedDependency; var disableContextParameterTracking = aiConfig.DisableContextParameterTracking; this._authenticatedUserId = executionContext.InitiatingUserId.ToString(); this._tracingService = tracingService; _httpClient = HttpHelper.GetHttpClient(); this.EventProperties = new AiProperties(); this.AddPrimaryPropertyValues(executionContext, service); if (!disableContextParameterTracking) { this.AddExecutionContextDetails(service, executionContext, pluginStage, workflowCategory); } }
/// <summary> /// Initializes a new instance of the <see cref="AiLogger"/> class. /// </summary> /// <param name="aiSetupJson">AiSetup json.</param> /// <param name="service">D365 IOrganizationService.</param> /// <param name="tracingService">D365 ITracingService.</param> /// <param name="executionContext">D365 IExecutionContext (IPluginExecutionContext or IWorkflowContext).</param> /// <param name="pluginStage">Plug-in stage from context</param> /// <param name="workflowCategory">Workflow category from context</param> public AiLogger(string aiSetupJson, IOrganizationService service, ITracingService tracingService, IExecutionContext executionContext, int?pluginStage, int?workflowCategory) { ValidateContextSpecific(pluginStage, workflowCategory); AiConfig aiConfig = new AiConfig(aiSetupJson); SetupAiLogger(aiConfig, service, tracingService, executionContext, pluginStage, workflowCategory); }
/// <summary> /// Initializes a new instance of the <see cref="AiLogger" /> class. /// </summary> /// <param name="aiConfig">AiConfiguration.</param> /// <param name="service">D365 IOrganizationService.</param> /// <param name="tracingService">D365 ITracingService.</param> /// <param name="executionContext">D365 IExecutionContext (IPluginExecutionContext or IWorkflowContext).</param> /// <param name="pluginStage">Plug-in stage from context</param> /// <param name="workflowCategory">Workflow category from context</param> public AiLogger( AiConfig aiConfig, IOrganizationService service, ITracingService tracingService, IExecutionContext executionContext, int?pluginStage, int?workflowCategory) { ValidateContextSpecific(pluginStage, workflowCategory); this.SetupAiLogger(aiConfig, service, tracingService, executionContext, pluginStage, workflowCategory); }