forked from serilog/serilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for .Destructure.XXX() methods
Supports Serilog "native" non-generic simple methods : - `ToMaximumCollectionCount` - `ToMaximumDepth` - `ToMaximumStringLength` and any *extension method* for `LoggerDestructuringConfiguration` This should fix serilog#1172
- Loading branch information
Showing
6 changed files
with
178 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/TestDummies/DummyHardCodedStringDestructuringPolicy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using Serilog.Core; | ||
using Serilog.Events; | ||
|
||
namespace TestDummies | ||
{ | ||
public class DummyHardCodedStringDestructuringPolicy : IDestructuringPolicy | ||
{ | ||
readonly string _hardCodedString; | ||
|
||
public DummyHardCodedStringDestructuringPolicy(string hardCodedString) | ||
{ | ||
_hardCodedString = hardCodedString ?? throw new ArgumentNullException(nameof(hardCodedString)); | ||
} | ||
|
||
public bool TryDestructure(object value, ILogEventPropertyValueFactory propertyValueFactory, out LogEventPropertyValue result) | ||
{ | ||
result = new ScalarValue(_hardCodedString); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters