/// <summary>
        /// Prevents a default instance of the <see cref="RollbarLogger" /> class from being created.
        /// </summary>
        private RollbarLogger()
        {
            this._name = string.Empty;

            this._rollbarOptions = new RollbarOptions();

            this._rollbar = RollbarFactory.CreateNew(null);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RollbarLogger" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="rollbarConfig">The rollbar configuration.</param>
        /// <param name="rollbarOptions">The options.</param>
        public RollbarLogger(string name
                             , IRollbarConfig rollbarConfig
                             , RollbarOptions rollbarOptions = default
                             )
        {
            this._name           = name;
            this._rollbarOptions = rollbarOptions ?? new RollbarOptions();

            this._rollbar = RollbarFactory.CreateNew(rollbarConfig);
        }
        /// <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;
            }
        }