Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RollbarMiddleware" /> class.
        /// </summary>
        /// <param name="nextRequestProcessor">The next request processor.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="rollbarOptions">The rollbar options.</param>
        public RollbarMiddleware(
            RequestDelegate nextRequestProcessor
            , IConfiguration configuration
            , ILoggerFactory loggerFactory
            , IOptions <RollbarOptions> rollbarOptions
            )
        {
            this._nextRequestProcessor = nextRequestProcessor;
            this._logger         = loggerFactory.CreateLogger <RollbarMiddleware>();
            this._rollbarOptions = rollbarOptions.Value;

            RollbarConfigurationUtil.DeduceRollbarTelemetryConfig(configuration);
            TelemetryCollector.Instance.StartAutocollection();
            RollbarConfigurationUtil.DeduceRollbarConfig(configuration);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RollbarLoggerProvider" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="options">The options.</param>
        public RollbarLoggerProvider(
            IConfiguration configuration,
            IOptions <RollbarOptions> options
            )
        {
            if (configuration != null)
            {
                RollbarConfigurationUtil.DeduceRollbarTelemetryConfig(configuration);
                TelemetryCollector.Instance.StartAutocollection();
                this._rollbarConfig = RollbarConfigurationUtil.DeduceRollbarConfig(configuration);
            }

            if (options != null)
            {
                this._rollbarOptions = options.Value;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RollbarLoggerProvider" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="options">The options.</param>
        /// <param name="httpContextAccessor">The HTTP context accessor.</param>
        public RollbarLoggerProvider(
            IConfiguration configuration
            , IOptions <RollbarOptions> options
            , IHttpContextAccessor httpContextAccessor
            )
        {
            Assumption.AssertNotNull(configuration, nameof(configuration));
            Assumption.AssertNotNull(options, nameof(options));

            RollbarConfigurationUtil.DeduceRollbarTelemetryConfig(configuration);
            TelemetryCollector.Instance.StartAutocollection();
            this._rollbarOptions      = options.Value;
            this._rollbarConfig       = RollbarConfigurationUtil.DeduceRollbarConfig(configuration);
            this._httpContextAccessor = httpContextAccessor;

            Assumption.AssertNotNull(this._rollbarConfig, nameof(this._rollbarConfig));
            Assumption.AssertNotNullOrWhiteSpace(this._rollbarConfig.AccessToken, nameof(this._rollbarConfig.AccessToken));
        }