示例#1
0
        private IBasicProperties GetBasicProperties(LogEventInfo logEvent, IModel model)
        {
            var basicProperties = model.CreateBasicProperties();

            basicProperties.ContentEncoding = "utf8";
            basicProperties.ContentType     = (UseJSON || Layout is JsonLayout) ? "application/json" : "text/plain";
            basicProperties.AppId           = RenderLogEvent(AppId, logEvent);
            if (string.IsNullOrEmpty(basicProperties.AppId))
            {
                basicProperties.AppId = logEvent.LoggerName;
            }
            basicProperties.Timestamp    = new AmqpTimestamp(MessageFormatter.GetEpochTimeStamp(logEvent));
            basicProperties.UserId       = RenderLogEvent(UserName, logEvent); // support Validated User-ID (see http://www.rabbitmq.com/extensions.html)
            basicProperties.DeliveryMode = (byte)DeliveryMode;
            var appCorrelationId = RenderLogEvent(CorrelationId, logEvent);

            if (!string.IsNullOrEmpty(appCorrelationId))
            {
                basicProperties.CorrelationId = appCorrelationId;
            }
            var appMessageType = RenderLogEvent(MessageType, logEvent);

            if (!string.IsNullOrEmpty(appMessageType))
            {
                basicProperties.Type = appMessageType;
            }
            return(basicProperties);
        }
示例#2
0
        private IBasicProperties GetBasicProperties(LogEventInfo @event, IModel model)
        {
            var basicProperties = model.CreateBasicProperties();

            basicProperties.ContentEncoding = "utf8";
            basicProperties.ContentType     = (UseJSON || Layout is JsonLayout) ? "application/json" : "text/plain";
            basicProperties.AppId           = AppId ?? @event.LoggerName;
            basicProperties.Timestamp       = new AmqpTimestamp(MessageFormatter.GetEpochTimeStamp(@event));
            basicProperties.UserId          = UserName;    // support Validated User-ID (see http://www.rabbitmq.com/extensions.html)
            basicProperties.DeliveryMode    = (byte)DeliveryMode;
            return(basicProperties);
        }
        private IBasicProperties GetBasicProperties(LogEventInfo @event, IModel model)
        {
            IBasicProperties basicProperties = model.CreateBasicProperties();

            basicProperties.ContentEncoding = "utf8";
            basicProperties.ContentType     = (UseJSON || Layout is JsonLayout) ? "application/json" : "text/plain";
            basicProperties.AppId           = AppId ?? @event.LoggerName;
            basicProperties.Timestamp       = new AmqpTimestamp(MessageFormatter.GetEpochTimeStamp(@event));
            basicProperties.UserId          = UserName;
            basicProperties.DeliveryMode    = (byte)DeliveryMode;
            return(basicProperties);
        }
示例#4
0
 private IBasicProperties GetBasicProperties(LogEventInfo @event)
 {
     return(new BasicProperties
     {
         ContentEncoding = "utf8",
         ContentType = (UseJSON || Layout is JsonLayout) ? "application/json" : "text/plain",
         AppId = AppId ?? @event.LoggerName,
         Timestamp = new AmqpTimestamp(MessageFormatter.GetEpochTimeStamp(@event)),
         UserId = UserName,                 // support Validated User-ID (see http://www.rabbitmq.com/extensions.html)
         DeliveryMode = (byte)DeliveryMode
     });
 }
示例#5
0
 private IBasicProperties GetBasicProperties(LogEventInfo @event)
 {
     return(new BasicProperties
     {
         ContentEncoding = "utf8",
         ContentType = (this.UseJSON || this.Layout is JsonLayout) ? "application/json" : "text/plain",
         AppId = this.AppId ?? @event.LoggerName,
         Timestamp = new AmqpTimestamp(MessageFormatter.GetEpochTimeStamp(@event)),
         UserId = this.UserName,
         DeliveryMode = (byte)this.DeliveryMode
     });
 }