diff --git a/src/Serilog/Core/Enrichers/PropertyEnricher.cs b/src/Serilog/Core/Enrichers/PropertyEnricher.cs index 7e1b67158..fb052d578 100644 --- a/src/Serilog/Core/Enrichers/PropertyEnricher.cs +++ b/src/Serilog/Core/Enrichers/PropertyEnricher.cs @@ -24,7 +24,7 @@ namespace Serilog.Core.Enrichers public class PropertyEnricher : ILogEventEnricher { readonly string _name; - readonly object _value; + readonly object? _value; readonly bool _destructureObjects; /// @@ -37,7 +37,7 @@ public class PropertyEnricher : ILogEventEnricher /// be converted to scalars, which are generally stored as strings. /// When is null /// When is empty or only contains whitespace - public PropertyEnricher(string name, object value, bool destructureObjects = false) + public PropertyEnricher(string name, object? value, bool destructureObjects = false) { LogEventProperty.EnsureValidName(name); diff --git a/src/Serilog/Core/ILogEventPropertyFactory.cs b/src/Serilog/Core/ILogEventPropertyFactory.cs index 15b87dd76..1cccdf7c7 100644 --- a/src/Serilog/Core/ILogEventPropertyFactory.cs +++ b/src/Serilog/Core/ILogEventPropertyFactory.cs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#nullable enable + using Serilog.Events; namespace Serilog.Core @@ -31,6 +33,6 @@ public interface ILogEventPropertyFactory /// then the value will be converted to a structure; otherwise, unknown types will /// be converted to scalars, which are generally stored as strings. /// Created instance. - LogEventProperty CreateProperty(string name, object value, bool destructureObjects = false); + LogEventProperty CreateProperty(string name, object? value, bool destructureObjects = false); } }