ArieGato / serilog-sinks-rabbitmq

Serilog Sink for RabbitMq
Apache License 2.0
53 stars 51 forks source link

hostnames can not be empty #76

Closed SinoMiles closed 5 years ago

SinoMiles commented 5 years ago

.

huan086 commented 5 years ago

Loading from configuration works

LoggerConfiguration loggerConfiguration = new LoggerConfiguration();
IConfigurationSection rabbitMqSection = configuration.GetSection("log:rabbitMq");
loggerConfiguration = loggerConfiguration
    .WriteTo.RabbitMQ((clientConfiguration, sinkConfiguration) =>
    {
        rabbitMqSection.Bind(clientConfiguration);
        sinkConfiguration.RestrictedToMinimumLevel = LogEventLevel.Warning;
    });

If you are configuring manually, then use Hostnames.Add

tsvetelintsonev commented 5 years ago

Hi, thank you for pointing this out. The configuration API in v3 has changed. I will update the readme.md later today . Until then maybe you can use the examples from this PR to set up the sink.

https://github.com/sonicjolt/serilog-sinks-rabbitmq/pull/69