Skip to content

Commit 7a8a339

Browse files
authored
Serilog 3 (#35)
1 parent 163ada6 commit 7a8a339

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Destructurama.ByIgnoring.Tests/Support/DelegatingSink.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,5 @@ public DelegatingSink(Action<LogEvent> write)
2626
_write = write ?? throw new ArgumentNullException(nameof(write));
2727
}
2828

29-
public void Emit(LogEvent logEvent)
30-
{
31-
_write(logEvent);
32-
}
29+
public void Emit(LogEvent logEvent) => _write(logEvent);
3330
}

src/Destructurama.ByIgnoring/ByIgnoring/DestructureByIgnoringPolicy.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
using System.Collections.Concurrent;
16+
using System.Diagnostics.CodeAnalysis;
1617
using System.Linq.Expressions;
1718
using System.Reflection;
1819
using Serilog.Core;
@@ -37,7 +38,7 @@ public DestructureByIgnoringPolicy(Func<object, bool> handleDestructuringPredica
3738
throw new ArgumentOutOfRangeException(nameof(ignoredPropertyPredicates), "At least one ignore rule must be supplied");
3839
}
3940

40-
public bool TryDestructure(object value, ILogEventPropertyValueFactory propertyValueFactory, out LogEventPropertyValue? result)
41+
public bool TryDestructure(object value, ILogEventPropertyValueFactory propertyValueFactory, [NotNullWhen(true)] out LogEventPropertyValue? result)
4142
{
4243
if (value == null || !_handleDestructuringPredicate(value))
4344
{
@@ -100,7 +101,7 @@ private static StructureValue BuildStructure(object value, ILogEventPropertyValu
100101
}
101102

102103
private static LogEventPropertyValue BuildLogEventProperty(object propertyValue, ILogEventPropertyValueFactory propertyValueFactory)
103-
{
104-
return propertyValue == null ? new ScalarValue(null) : propertyValueFactory.CreatePropertyValue(propertyValue, destructureObjects: true);
105-
}
104+
=> propertyValue == null
105+
? ScalarValue.Null
106+
: propertyValueFactory.CreatePropertyValue(propertyValue, destructureObjects: true);
106107
}

src/Destructurama.ByIgnoring/Destructurama.ByIgnoring.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
<Product>Serilog Lambda-Driven Destructuring Support</Product>
77
<Description>Specify how complex types are logged to Serilog by excluding individual properties.</Description>
88
<RootNamespace>Destructurama</RootNamespace>
9+
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
910
</PropertyGroup>
1011

1112
<ItemGroup>
12-
<PackageReference Include="Serilog" Version="2.8.0" />
13+
<PackageReference Include="Serilog" Version="3.1.1" />
14+
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
1315
<Using Remove="System.Net.Http"/>
1416
<InternalsVisibleTo Include="Destructurama.ByIgnoring.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fe215af9b769897395aac526ca6744222fcf543787b16f58980844d6c49f65bbf0a62502d69646c58f14a8a29ba60d43c85a2a5ef1ed103c9a0e18d6491e4b0bafd2c25e290028d19203d4366ae5651aafd48abaf485588fd6a25fbe23c2c9a644a24337a041966b09cbb73dc3a080bf79564d15a26e97c1bff4f345ee256a9" />
1517
</ItemGroup>

0 commit comments

Comments
 (0)