/// <summary> /// Initializes a new instance of the <see cref="RollbarExceptionHandler" /> class. /// </summary> /// <param name="rollbarConfig">The rollbar configuration.</param> /// <param name="rollbarBlockingTimeout">The rollbar blocking timeout.</param> public RollbarExceptionHandler( IRollbarInfrastructureConfig rollbarConfig, TimeSpan?rollbarBlockingTimeout ) : base(rollbarErrorLevelByPlugInErrorLevel, customPrefix, rollbarConfig, rollbarBlockingTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="RollbarPlugInCore"/> class. /// </summary> /// <param name="rollbarConfig">The rollbar configuration.</param> /// <param name="rollbarBlockingTimeout">The rollbar blocking timeout.</param> /// <param name="formatProvider">The format provider.</param> public RollbarPlugInCore( IRollbarInfrastructureConfig rollbarConfig, TimeSpan? rollbarBlockingTimeout, IFormatProvider? formatProvider ) : base(rollbarErrorLevelByPlugInErrorLevel, customPrefix, rollbarConfig, rollbarBlockingTimeout) { this._formatProvider = formatProvider; }
/// <summary> /// Initializes a new instance of the <see cref="RollbarSink"/> class. /// </summary> /// <param name="rollbarConfig">The Rollbar configuration.</param> /// <param name="rollbarBlockingLoggingTimeout">The Rollbar blocking logging timeout.</param> /// <param name="formatProvider">The format provider.</param> public RollbarSink( IRollbarInfrastructureConfig rollbarConfig, TimeSpan?rollbarBlockingLoggingTimeout, IFormatProvider?formatProvider ) { this._rollbarPlugIn = new RollbarPlugInCore(rollbarConfig, rollbarBlockingLoggingTimeout, formatProvider); }
internal void Init(IRollbarInfrastructureConfig config) { Assumption.AssertNotNull(config, nameof(config)); this._config = config; this._config.Reconfigured += _config_Reconfigured; this.EvaluateUseOfLocalPayloadStoreOptions(this._config.RollbarOfflineStoreOptions); this.Start(); }
/// <summary> /// Provides configuration for RollbarSink. /// </summary> /// <param name="loggerConfiguration">The logger configuration.</param> /// <param name="rollbarConfig">The Rollbar configuration.</param> /// <param name="rollbarBlockingLoggingTimeout">The Rollbar blocking logging timeout.</param> /// <param name="formatProvider">The format provider.</param> /// <param name="restrictedToMinimumLevel"> /// The minimum level for events passed through the sink. Ignored when <paramref name="levelSwitch"/> is specified. /// </param> /// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param> /// <returns>LoggerConfiguration.</returns> public static LoggerConfiguration RollbarSink( this LoggerSinkConfiguration loggerConfiguration, IRollbarInfrastructureConfig rollbarConfig, TimeSpan?rollbarBlockingLoggingTimeout, IFormatProvider?formatProvider, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, LoggingLevelSwitch?levelSwitch = null) { return(loggerConfiguration.Sink( new RollbarSink(rollbarConfig, rollbarBlockingLoggingTimeout, formatProvider), restrictedToMinimumLevel, levelSwitch)); }
/// <summary> /// Provides configuration for RollbarSink. /// </summary> /// <param name="loggerConfiguration">The logger configuration.</param> /// <param name="rollbarConfig">The Rollbar configuration.</param> /// <param name="restrictedToMinimumLevel"> /// The minimum level for events passed through the sink. Ignored when <paramref name="levelSwitch"/> is specified. /// </param> /// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param> /// <returns>LoggerConfiguration.</returns> public static LoggerConfiguration RollbarSink( this LoggerSinkConfiguration loggerConfiguration, IRollbarInfrastructureConfig rollbarConfig, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, LoggingLevelSwitch?levelSwitch = null ) { return(RollbarSink( loggerConfiguration, rollbarConfig, null, null, restrictedToMinimumLevel, levelSwitch)); }
/// <summary> /// Initializes the specified configuration. /// </summary> /// <param name="config">The configuration.</param> /// <exception cref="RollbarException"> /// Exception while initializing the internal services! /// </exception> public void Init(IRollbarInfrastructureConfig config) { Assumption.AssertNotNull(config, nameof(config)); lock (this._syncLock) { if (this._isInitialized) { string msg = $"{typeof(RollbarInfrastructure).Name} can not be initialized more than once!"; traceSource.TraceInformation(msg); throw new RollbarException( InternalRollbarError.InfrastructureError, msg ); } this._config = config; this.ValidateConfiguration(); this._config.Reconfigured += _config_Reconfigured; this._isInitialized = true; // now, since the basic infrastructure seems to be good and initialized, // let's initialize all the dependent services of the infrastructure: try { RollbarQueueController.Instance !.Init(config); RollbarTelemetryCollector.Instance !.Init(config.RollbarTelemetryOptions); // NOTE: RollbarConfig // - init ConnectivityMonitor service as needed // NOTE: It should be sufficient to make ConnectivityMonitor as internal class // It is only used by RollbarClient and RollbarQueueController that are // already properly deactivated in single-threaded environments. } catch (Exception ex) { this._isInitialized = false; throw new RollbarException( InternalRollbarError.InfrastructureError, "Exception while initializing the internal services!", ex ); } } }
/// <summary> /// Initializes the specified configuration. /// </summary> /// <param name="config">The configuration.</param> /// <exception cref="RollbarException"> /// Exception while initializing the internal services! /// </exception> public void Init(IRollbarInfrastructureConfig config) { Assumption.AssertNotNull(config, nameof(config)); Assumption.AssertNotNull(RollbarInfrastructure.Instance, nameof(RollbarInfrastructure.Instance)); Assumption.AssertFalse(RollbarInfrastructure.Instance.IsInitialized, nameof(RollbarInfrastructure.Instance.IsInitialized)); lock (this._syncLock) { if (this.IsInitialized) { string msg = $"{typeof(RollbarInfrastructure).Name} can not be initialized more than once!"; traceSource.TraceInformation(msg); throw new RollbarException( InternalRollbarError.InfrastructureError, msg ); } // now, since the basic infrastructure seems to be good and initialized, // let's initialize all the dependent services of the infrastructure: try { this._config = config; this.ValidateConfiguration(); this._config.Reconfigured += _config_Reconfigured; this._lazyQueueController.Value.Init(config); this._lazyTelemetryCollector.Value.Init(config.RollbarTelemetryOptions); _ = this._lazyConnectivityMonitor.Value; //Assumption.AssertTrue(RollbarInfrastructure.Instance.IsInitialized, nameof(RollbarInfrastructure.Instance.IsInitialized)); } catch (Exception ex) { throw new RollbarException( InternalRollbarError.InfrastructureError, "Exception while initializing the internal services!", ex ); } } }
public void SetupFixture() { RollbarUnitTestEnvironmentUtil.SetupLiveTestRollbarInfrastructure(); this._config = RollbarInfrastructure.Instance.Config; }