Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1686 - nullable annotations for PropertyEnricher #1704

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}
}