예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TelemetryClientLogger"/> class.
 /// </summary>
 /// <param name="categoryName">The category name.</param>
 /// <param name="telemetryClient">The telemetry client.</param>
 /// <param name="applicationInsightsLoggerOptions">The logger options.</param>
 public TelemetryClientLogger(
     string categoryName,
     IRawTelemetryClient telemetryClient,
     TelemetryClientLoggerOptions applicationInsightsLoggerOptions)
 {
     this.categoryName    = categoryName;
     this.telemetryClient = telemetryClient;
     this.applicationInsightsLoggerOptions = applicationInsightsLoggerOptions ?? throw new ArgumentNullException(nameof(applicationInsightsLoggerOptions));
 }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="TelemetryClientLoggerProvider" /> class.
        /// </summary>
        /// <param name="rawTelemetryClient">The telemetry client contract with the raw methods.</param>
        /// <param name="telemetryClientLoggerOptions">The options for the telemetry client.</param>
        public TelemetryClientLoggerProvider(
            IRawTelemetryClient rawTelemetryClient,
            IOptions <TelemetryClientLoggerOptions> telemetryClientLoggerOptions)
        {
            this.client = rawTelemetryClient;

            if (telemetryClientLoggerOptions?.Value == null)
            {
                throw new ArgumentNullException(nameof(telemetryClientLoggerOptions));
            }

            this.options = telemetryClientLoggerOptions.Value;
            this.client  = rawTelemetryClient;
        }