Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ApiApprovalTests
{
/// <summary>Check for changes to the public APIs.</summary>
/// <param name="type">The type used as a marker for the assembly whose public API change you want to check.</param>
[TestCase(typeof(LoggerConfigurationAppSettingsExtensions))]
[TestCase(typeof(LoggerConfigurationAttributedExtensions))]
public void PublicApi_Should_Not_Change_Unintentionally(Type type)
{
string publicApi = type.Assembly.GeneratePublicApi(new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace Destructurama.Attributed
}
namespace Destructurama
{
public static class LoggerConfigurationAppSettingsExtensions
public static class LoggerConfigurationAttributedExtensions
{
public static Serilog.LoggerConfiguration UsingAttributes(this Serilog.Configuration.LoggerDestructuringConfiguration configuration) { }
public static Serilog.LoggerConfiguration UsingAttributes(this Serilog.Configuration.LoggerDestructuringConfiguration configuration, System.Action<Destructurama.Attributed.AttributedDestructuringPolicyOptions> configure) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ public LogAsScalarAttribute(bool isMutable = false)
}

/// <inheritdoc/>
public LogEventPropertyValue CreateLogEventPropertyValue(object? value, ILogEventPropertyValueFactory propertyValueFactory) =>
new ScalarValue(_isMutable ? value?.ToString() : value);
public LogEventPropertyValue CreateLogEventPropertyValue(object? value, ILogEventPropertyValueFactory propertyValueFactory)
{
var v = _isMutable ? value?.ToString() : value;
return v == null ? ScalarValue.Null : new ScalarValue(v);
}

/// <inheritdoc/>
public bool TryCreateLogEventProperty(string name, object? value, ILogEventPropertyValueFactory propertyValueFactory, out LogEventProperty property)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private LogEventPropertyValue CreateValue(object? value)
{
IEnumerable<string> strings => new SequenceValue(strings.Select(s => new ScalarValue(FormatMaskedValue(s)))),
string s => new ScalarValue(FormatMaskedValue(s)),
_ => new ScalarValue(null)
_ => ScalarValue.Null
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public bool TryCreateLogEventProperty(string name, object? value, ILogEventPrope
{
if (value == null)
{
property = new(name, new ScalarValue(value));
property = new(name, ScalarValue.Null);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="[2.10.0,4.0.0)" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="PolySharp" Version="1.14.1" PrivateAssets="All" />
<InternalsVisibleTo Include="Destructurama.Attributed.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100638a43140e8a1271c1453df1379e64b40b67a1f333864c1aef5ac318a0fa2008545c3d35a82ef005edf0de1ad1e1ea155722fe289df0e462f78c40a668cbc96d7be1d487faef5714a54bb4e57909c86b3924c2db6d55ccf59939b99eb0cab6e8a91429ba0ce630c08a319b323bddcbbd509f1afe4ae77a6cbb8b447f588febc3" />
<InternalsVisibleTo Include="Benchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100638a43140e8a1271c1453df1379e64b40b67a1f333864c1aef5ac318a0fa2008545c3d35a82ef005edf0de1ad1e1ea155722fe289df0e462f78c40a668cbc96d7be1d487faef5714a54bb4e57909c86b3924c2db6d55ccf59939b99eb0cab6e8a91429ba0ce630c08a319b323bddcbbd509f1afe4ae77a6cbb8b447f588febc3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Destructurama;
/// <summary>
/// Adds the Destructure.UsingAttributes() extension to <see cref="LoggerConfiguration"/>.
/// </summary>
public static class LoggerConfigurationAppSettingsExtensions
public static class LoggerConfigurationAttributedExtensions
{
/// <summary>
/// Adds a custom <see cref="IDestructuringPolicy"/> to enable manipulation of how objects
Expand Down