public static LoggerConfiguration WithDummyHardCodedString(
     this LoggerDestructuringConfiguration loggerDestructuringConfiguration,
     string hardCodedString
     )
 {
     return(loggerDestructuringConfiguration.With(new DummyHardCodedStringDestructuringPolicy(hardCodedString)));
 }
Esempio n. 2
0
        /// <summary>
        /// Build custom rule for destructuring
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static LoggerConfiguration ByCustomRules(this LoggerDestructuringConfiguration builder,
                                                        Action <CustomPolicyOptions> configure)
        {
            var rules = new CustomPolicyOptions();

            configure(rules);
            return(builder.With(new CustomRuleDestructuringPolicy(rules)));
        }
Esempio n. 3
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.LocalDateTime
 /// </summary>
 /// <remarks>Deserialisation: LocalDateTimePattern.ExtendedIso.Parse(str) or use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithLocalDateTime(this LoggerDestructuringConfiguration ldc)
 {
     if (ldc == null)
     {
         throw new ArgumentNullException(nameof(ldc));
     }
     return(ldc.With <LocalDateTimeDestructuringPolicy>());
 }
Esempio n. 4
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.ZonedDateTime
 /// </summary>
 /// <remarks>Deserialisation: Use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithZonedDateTime(this LoggerDestructuringConfiguration ldc, IDateTimeZoneProvider provider)
 {
     if (ldc == null)
     {
         throw new ArgumentNullException(nameof(ldc));
     }
     return(ldc.With(new ZonedDateTimeDestructuringPolicy(provider)));
 }
 /// <summary>
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration UsingAttributes(this LoggerDestructuringConfiguration configuration)
 {
     return(configuration.With <AttributedDestructuringPolicy>());
 }
Esempio n. 6
0
 /// <summary>
 /// Destructure.ByIgnoringProperties takes one or more expressions that access a property, e.g. obj => obj.Property, and uses the property names to determine which
 /// properties are ignored when an object of type TDestruture is destructured by serilog.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <param name="ignoredProperty">The function expressions that expose the properties to ignore.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration ByIgnoringProperties <TDestruture>(this LoggerDestructuringConfiguration configuration, params Expression <Func <TDestruture, object> >[] ignoredProperty)
 {
     return(configuration.With(new DestructureByIgnoringPolicy <TDestruture>(ignoredProperty)));
 }
Esempio n. 7
0
 /// <summary>
 /// Destructure.ByMaskingProperties takes one or more property names, e.g. "Hash", and uses them to determine which
 /// properties are masked when an object of is destructured by serilog.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <param name="opts"><see cref="Action"/> to configure <see cref="MaskingOptions"/>.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration ByMaskingProperties(this LoggerDestructuringConfiguration configuration, Action<MaskingOptions> opts)
 {
     var maskingOptions = new MaskingOptions();
     opts(maskingOptions);
     return configuration.With(new DestructureByMaskingPolicy(maskingOptions));
 }
Esempio n. 8
0
 /// <summary>
 /// Destructure.ByMaskingProperties takes one or more property names, e.g. "Hash", and uses them to determine which
 /// properties are masked when an object of is destructured by serilog.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <param name="maskedPropertyName">The property name to hide.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration ByMaskingProperties(this LoggerDestructuringConfiguration configuration, params string[] maskedPropertyName)
 {
     return configuration.With(new DestructureByMaskingPolicy(maskedPropertyName));
 }
Esempio n. 9
0
 public static LoggerConfiguration HasNonSensitiveProperties <T>(this LoggerDestructuringConfiguration conf, params Expression <Func <T, object> >[] sensitiveProperties)
 {
     return(conf.With(new SensitiveInformationPropertyMarkingDestructuringPolicy <T>(shouldContain: false, properties: sensitiveProperties)));
 }
Esempio n. 10
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.ZonedDateTime
 /// </summary>
 /// <remarks>Deserialisation: Use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithZonedDateTime(this LoggerDestructuringConfiguration ldc, IDateTimeZoneProvider provider) => ldc.With(new ZonedDateTimeDestructuringPolicy(provider));
Esempio n. 11
0
 /// <summary>
 /// Enable destructuring of JSON.NET dynamic objects.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration JsonNetTypes(this LoggerDestructuringConfiguration configuration)
 {
     return(configuration.With <JsonNetDestructuringPolicy>());
 }
Esempio n. 12
0
        /// <summary>
        /// Fix destructuring for record type
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static LoggerConfiguration ByCustomRules(this LoggerDestructuringConfiguration builder)
        {
            var rules = new CustomPolicyOptions().ByProperRecordProcessing();

            return(builder.With(new CustomRuleDestructuringPolicy(rules)));
        }
Esempio n. 13
0
 /// <summary>
 ///     Enable destructuring of JSON.NET dynamic objects.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration NewtonsoftJsonTypes(this LoggerDestructuringConfiguration configuration)
 {
     return(configuration.With <NewtonsoftJsonDestructuringPolicy>());
 }
Esempio n. 14
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.OffsetDate
 /// </summary>
 /// <remarks>Deserialisation: OffsetDatePattern.GeneralIso.Parse(str) or use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithOffsetDate(this LoggerDestructuringConfiguration ldc) => ldc.With <OffsetDateDestructuringPolicy>();
Esempio n. 15
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.LocalTime
 /// </summary>
 /// <remarks>Deserialisation: LocalTimePattern.ExtendedIso.Parse(str) or use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithLocalTime(this LoggerDestructuringConfiguration ldc) => ldc.With <LocalTimeDestructuringPolicy>();
Esempio n. 16
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.Instant
 /// </summary>
 /// <remarks>Deserialisation: InstantPattern.General.Parse(str) or use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithInstant(this LoggerDestructuringConfiguration ldc) => ldc.With <InstantDestructuringPolicy>();
Esempio n. 17
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.Period
 /// </summary>
 /// <remarks>Deserialisation: PeriodPattern.Roundtrip.Parse(str) or use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithPeriod(this LoggerDestructuringConfiguration ldc) => ldc.With <PeriodDestructuringPolicy>();
Esempio n. 18
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.Duration
 /// </summary>
 /// <remarks>Deserialisation: Use NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithDuration(this LoggerDestructuringConfiguration ldc) => ldc.With <DurationDestructuringPolicy>();
 static public LoggerConfiguration ByTransformingEx <TValue>(this LoggerDestructuringConfiguration loggerConfiguration, Func <TValue, object> transformation)
 {
     return(loggerConfiguration.With(new ProjectedDestructuringPolicy(t => typeof(TValue).IsAssignableFrom(t), o => transformation((TValue)o))));
 }
Esempio n. 20
0
 // .Destructure...
 // ============
 // TODO: add overload for array argument (IDestructuringPolicy[])
 // expose `With(params IDestructuringPolicy[] destructuringPolicies)` as if it was `With(IDestructuringPolicy policy)`
 static LoggerConfiguration With(LoggerDestructuringConfiguration loggerDestructuringConfiguration, IDestructuringPolicy policy)
 => loggerDestructuringConfiguration.With(policy);
Esempio n. 21
0
 /// <summary>
 ///     Enable destructuring of JSON.NET dynamic objects.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration NetTopologySuiteTypes(this LoggerDestructuringConfiguration configuration)
 {
     return(configuration.With <NetTopologySuiteDestructuringPolicy>());
 }
Esempio n. 22
0
 /// <summary>
 ///     Enable destructuring of JSON.NET dynamic objects.
 /// </summary>
 /// <param name="configuration">The logger configuration to apply configuration to.</param>
 /// <returns>An object allowing configuration to continue.</returns>
 public static LoggerConfiguration SystemTextJsonTypes(this LoggerDestructuringConfiguration configuration)
 {
     return(configuration.With <SystemTextJsonDestructuringPolicy>());
 }
Esempio n. 23
0
 /// <summary>
 /// Adds support for logging instances of NodaTime.DateTimeZone
 /// </summary>
 /// <remarks>Deserialisation: Use IDateTimeZoneProvider or NodaTime.Serialization.JsonNet</remarks>
 public static LoggerConfiguration WithDateTimeZone(this LoggerDestructuringConfiguration ldc) => ldc.With <DateTimeZoneDestructuringPolicy>();
 internal static LoggerConfiguration With(LoggerDestructuringConfiguration loggerDestructuringConfiguration,
                                          IDestructuringPolicy policy)
 {
     return(loggerDestructuringConfiguration.With(policy));
 }
Esempio n. 25
0
 public static LoggerConfiguration AsSensitive <T>(this LoggerDestructuringConfiguration conf, bool stringify = true)
 {
     return(conf.With(new SensitiveInformationDestructuringPolicy <T>(stringify)));
 }
Esempio n. 26
0
 public static LoggerConfiguration AsSensitiveByTransforming <T>(this LoggerDestructuringConfiguration conf, Func <T, object> transform)
 {
     return(conf.With(new SensitiveInformationTransformativeDestructuringPolicy <T>(transform)));
 }
		protected override void Configure( LoggerDestructuringConfiguration configuration ) => configuration.With( Policies.Fixed() );