Publish() public method

Publishes a message to RabbitMq Exchange
public Publish ( string message ) : void
message string
return void
        /// <summary>
        /// Emit method, used by Serilog to send log events to RabbitMq, using this sink
        /// </summary>
        /// <param name="logEvent"></param>
        public void Emit(LogEvent logEvent)
        {
            var writer = new StringWriter();

            _formatter.Format(logEvent, writer);
            _client.Publish(writer.ToString());
        }
Beispiel #2
0
 protected override void EmitBatch(IEnumerable <LogEvent> events)
 {
     foreach (var logEvent in events)
     {
         var sw = new StringWriter();
         _formatter.Format(logEvent, sw);
         _client.Publish(sw.ToString());
     }
 }