コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            this.configuration = configuration;
            this.builder = new AirbrakeNoticeBuilder(configuration);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            this.configuration = configuration;
            this.builder = new AirbrakeNoticeBuilder(configuration);
            //this.log = LogManager.GetLogger(GetType());
        }
コード例 #3
0
 public void SetUp()
 {
     this.config = new AirbrakeConfiguration
     {
         ApiKey = "123456",
         EnvironmentName = "test"
     };
     this.builder = new AirbrakeNoticeBuilder(this.config);
 }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.configuration = configuration;
            this.builder       = new AirbrakeNoticeBuilder(configuration);
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.configuration = configuration;
            this.builder       = new AirbrakeNoticeBuilder(configuration);
            this.log           = LogManager.GetLogger(GetType());
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="backtraceBuilder"> </param>
        public AirbrakeClient(AirbrakeConfiguration configuration, IBuilder<Exception, Backtrace> backtraceBuilder = null)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            this.configuration = configuration;

            if (backtraceBuilder == null)
                backtraceBuilder = new BacktraceBuilder(LogManager.GetLogger<BacktraceBuilder>());
            this.builder = new AirbrakeNoticeBuilder(configuration,backtraceBuilder);

            this.log = LogManager.GetLogger(GetType());
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="backtraceBuilder"> </param>
        public AirbrakeClient(AirbrakeConfiguration configuration, IBuilder <Exception, Backtrace> backtraceBuilder = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.configuration = configuration;

            if (backtraceBuilder == null)
            {
                backtraceBuilder = new BacktraceBuilder(LogManager.GetLogger <BacktraceBuilder>());
            }
            this.builder = new AirbrakeNoticeBuilder(configuration, backtraceBuilder);

            this.log = LogManager.GetLogger(GetType());
        }
コード例 #8
0
        public void Send_EndRequestEventIsInvoked_And_ResponseOnlyContainsApiError()
        {
            bool requestEndInvoked = false;
             AirbrakeResponseError[] errors = null;
             int i = 0;

             this.client.RequestEnd += (sender, e) =>
             {
            requestEndInvoked = true;
            errors = e.Response.Errors;
             };

             var configuration = new AirbrakeConfiguration
             {
            ApiKey = Guid.NewGuid().ToString("N"),
            EnvironmentName = "test",
             };

             var builder = new AirbrakeNoticeBuilder(configuration);

             AirbrakeNotice notice = builder.Notice(new Exception("Test"));

             notice.Request = new AirbrakeRequest("http://example.com", "Test")
             {
            Params = new[]
            {
               new AirbrakeVar("TestKey", "TestValue")
            }
             };

             this.client.Send(notice);

             while (!requestEndInvoked)
             {
            // Sleep for maximum 5 seconds to wait for the request to end. Can probably be done more elegantly.
            if (i++ == 50)
               break;

            Thread.Sleep(100);
             }

             Assert.That(requestEndInvoked, Is.True);
             Assert.That(errors, Is.Not.Null);
             Assert.That(errors, Has.Length.EqualTo(1));
        }
コード例 #9
0
 public SharpbrakeClient(AirbrakeClient client, AirbrakeNoticeBuilder builder)
 {
   this.Client = new AirbrakeClient();
   this.Builder = new AirbrakeNoticeBuilder();
 }
コード例 #10
0
ファイル: AirbrakeClient.cs プロジェクト: Ggio90/SharpBrake
 /// <summary>
 /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
 /// </summary>
 public AirbrakeClient()
 {
     this.builder = new AirbrakeNoticeBuilder();
     this.log = LogManager.GetLogger(GetType());
 }
コード例 #11
0
ファイル: AirbrakeClient.cs プロジェクト: friism/SharpBrake
 /// <summary>
 /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
 /// </summary>
 public AirbrakeClient()
 {
     this.builder = new AirbrakeNoticeBuilder();
     this.log     = LogManager.GetLogger(GetType());
 }