Skip to content

Commit

Permalink
Fix serilog#1686 - nullable annotations for PropertyEnricher (serilog…
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt authored and Twinki14 committed Dec 30, 2023
1 parent 61f4011 commit 94af348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Serilog/Core/Enrichers/PropertyEnricher.cs
Expand Up @@ -24,7 +24,7 @@ namespace Serilog.Core.Enrichers
public class PropertyEnricher : ILogEventEnricher
{
readonly string _name;
readonly object _value;
readonly object? _value;
readonly bool _destructureObjects;

/// <summary>
Expand All @@ -37,7 +37,7 @@ public class PropertyEnricher : ILogEventEnricher
/// be converted to scalars, which are generally stored as strings.</param>
/// <exception cref="ArgumentNullException">When <paramref name="name"/> is <code>null</code></exception>
/// <exception cref="ArgumentException">When <paramref name="name"/> is empty or only contains whitespace</exception>
public PropertyEnricher(string name, object value, bool destructureObjects = false)
public PropertyEnricher(string name, object? value, bool destructureObjects = false)
{
LogEventProperty.EnsureValidName(name);

Expand Down
4 changes: 3 additions & 1 deletion src/Serilog/Core/ILogEventPropertyFactory.cs
Expand Up @@ -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
Expand All @@ -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.</param>
/// <returns>Created <see cref="LogEventProperty"/> instance.</returns>
LogEventProperty CreateProperty(string name, object value, bool destructureObjects = false);
LogEventProperty CreateProperty(string name, object? value, bool destructureObjects = false);
}
}

0 comments on commit 94af348

Please sign in to comment.