public static LogEventJsonConverterOptions WithDefaultKeyPrefixes(this LogEventJsonConverterOptions options)
        {
            options.DateTimeOffsetKeyPrefix = "dt_";
            options.DateTimeKeyPrefix       = "dt_";
            options.StringKeyPrefix         = "s_";
            options.BooleanKeyPrefix        = "b_";
            options.EnumKeyPrefix           = "k_";
            options.IntKeyPrefix            = "i_";
            options.LongKeyPrefix           = "i_";
            options.FloatKeyPrefix          = "f_";
            options.DoubleKeyPrefix         = "f_";
            options.UintKeyPrefix           = "i_";
            options.UlongKeyPrefix          = "i_";
            options.DecimalKeyPrefix        = "d_";
            options.ObjectKeyPrefix         = "o_";
            options.ArrayKeyPrefix          = "a_";

            return(options);
        }
Example #2
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 #3
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 static LogEventJsonConverterOptions WithWriteIndented(this LogEventJsonConverterOptions options, bool value = true)
        {
            options.JsonOptions.WriteIndented = value;

            return(options);
        }
        public static LogEventJsonConverterOptions WithCamelCaseNamingPolicy(this LogEventJsonConverterOptions options)
        {
            options.JsonOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;

            return(options);
        }
Example #6
0
 public JsonToUtf8BytesFormatter(LogEventJsonConverterOptions options = null)
 {
     this.options = options ?? new LogEventJsonConverterOptions();
     this.options.JsonOptions.Converters.Insert(0, new LogEventJsonConverter(this.options));
 }