示例#1
0
        /// <summary>
        /// Sends the given event to Rollbar
        /// </summary>
        /// <param name="loggingEvent">The event to report</param>
        protected override void Append(LoggingEvent loggingEvent)
        {
            var client = new RollbarClient(_configuration);

            Task task = null;

            if (loggingEvent.Level >= Level.Critical)
            {
                task = Send(loggingEvent, client.SendCriticalMessage, client.SendCriticalException);
            }
            else if (loggingEvent.Level >= Level.Error)
            {
                task = Send(loggingEvent, client.SendErrorMessage, client.SendErrorException);
            }
            else if (loggingEvent.Level >= Level.Warn)
            {
                task = Send(loggingEvent, client.SendWarningMessage, client.SendWarningException);
            }
            else if (loggingEvent.Level >= Level.Info)
            {
                task = client.SendInfoMessage(loggingEvent.RenderedMessage);
            }
            else if (loggingEvent.Level >= Level.Debug)
            {
                task = client.SendDebugMessage(loggingEvent.RenderedMessage);
            }

            if (task != null && !Asynchronous)
            {
                task.Wait(TimeSpan.FromSeconds(5));
            }
        }
示例#2
0
        public void when_calling_send_info_message_task_returns_and_can_be_used()
        {
            var client  = new RollbarClient();
            var message = "";

            var task = client.SendInfoMessage(message);

            Assert.IsNotNull(task);
            Assert.DoesNotThrow(() => task.Wait(0));
        }