Example #1
0
 public RabbitMqSink(
     RabbitMqSinkOptions options,
     IEndpointResolver endpointResolver,
     Action<ConnectionFactory> connectionFactorySetup,
     ITextFormatter formatter,
     TextToBinaryFormatterOptions formatterOptions = null,
     string clientProviderName = null) : this(options, endpointResolver, connectionFactorySetup,
Example #2
0
        private static RabbitMqSinkOptions Create(this LoggerSinkConfiguration configuration, Action <RabbitMqSinkOptions> optionsSetup)
        {
            if (optionsSetup == null)
            {
                throw new ArgumentNullException(nameof(optionsSetup));
            }

            RabbitMqSinkOptions options = new RabbitMqSinkOptions();

            optionsSetup.Invoke(options);

            return(options);
        }
Example #3
0
        private static RabbitMqSinkOptions Create(this LoggerAuditSinkConfiguration configuration, Action <RabbitMqSinkOptions> optionsSetup)
        {
            if (optionsSetup == null)
            {
                throw new ArgumentNullException(nameof(optionsSetup));
            }

            RabbitMqSinkOptions options = new RabbitMqSinkOptions();

            // Set confirm publish by default for Audit
            options.ConfirmPublish = true;
            options.ExchangeName   = RabbitMqSinkOptions.DefaultAuditToExchange;
            optionsSetup.Invoke(options);

            return(options);
        }
Example #4
0
        public static LoggerAuditSinkConfiguration RabbitMq(
            this LoggerAuditSinkConfiguration configuration,
            Action <RabbitMqSinkOptions> optionsSetup,
            IConnection connection,
            IBinaryFormatter binaryFormatter,
            LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose,
            LoggingLevelSwitch levelSwitch         = null,
            bool autoCloseConnection = true)
        {
            RabbitMqSinkOptions options = configuration.Create(optionsSetup);

            RabbitMqSink rabbitMqSink = new RabbitMqSink(options, connection, binaryFormatter,
                                                         autoCloseConnection);

            configuration.Sink(rabbitMqSink, restrictedToMinimumLevel, levelSwitch);

            return(configuration);
        }
Example #5
0
        public static LoggerSinkConfiguration RabbitMq(
            this LoggerSinkConfiguration configuration,
            Action <RabbitMqSinkOptions> optionsSetup,
            AmqpTcpEndpoint endpoint,
            Action <ConnectionFactory> connectionFactorySetup,
            IBinaryFormatter binaryFormatter,
            LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose,
            LoggingLevelSwitch levelSwitch         = null,
            string clientProviderName = null)
        {
            RabbitMqSinkOptions options = configuration.Create(optionsSetup);

            RabbitMqSink rabbitMqSink = new RabbitMqSink(options, endpoint, connectionFactorySetup, binaryFormatter,
                                                         clientProviderName);

            configuration.Sink(rabbitMqSink, restrictedToMinimumLevel, levelSwitch);

            return(configuration);
        }
Example #6
0
        public static LoggerAuditSinkConfiguration RabbitMq(
            this LoggerAuditSinkConfiguration configuration,
            Action <RabbitMqSinkOptions> optionsSetup,
            IConnection connection,
            LogEventJsonConverterOptions jsonConverterOptions = null,
            LogEventLevel restrictedToMinimumLevel            = LogEventLevel.Verbose,
            LoggingLevelSwitch levelSwitch = null,
            bool autoCloseConnection       = true)
        {
            RabbitMqSinkOptions options = configuration.Create(optionsSetup);

            RabbitMqSink rabbitMqSink = new RabbitMqSink(options, connection,
                                                         new JsonToUtf8BytesFormatter(jsonConverterOptions ?? new LogEventJsonConverterOptions()),
                                                         autoCloseConnection);

            configuration.Sink(rabbitMqSink, restrictedToMinimumLevel, levelSwitch);

            return(configuration);
        }
Example #7
0
        public static LoggerAuditSinkConfiguration RabbitMq(
            this LoggerAuditSinkConfiguration configuration,
            Action <RabbitMqSinkOptions> optionsSetup,
            IEndpointResolver endpointResolver,
            Action <ConnectionFactory> connectionFactorySetup,
            LogEventJsonConverterOptions jsonConverterOptions = null,
            LogEventLevel restrictedToMinimumLevel            = LogEventLevel.Verbose,
            LoggingLevelSwitch levelSwitch = null,
            string clientProviderName      = null)
        {
            RabbitMqSinkOptions options = configuration.Create(optionsSetup);

            RabbitMqSink rabbitMqSink = new RabbitMqSink(options, endpointResolver, connectionFactorySetup,
                                                         new JsonToUtf8BytesFormatter(jsonConverterOptions ?? new LogEventJsonConverterOptions()),
                                                         clientProviderName);

            configuration.Sink(rabbitMqSink, restrictedToMinimumLevel, levelSwitch);

            return(configuration);
        }
 public ChannelsPoolPolicy(IConnection connection, RabbitMqSinkOptions options)
 {
     Connection = connection;
     Options    = options;
 }