I'd like to issue a PR for some sample code I just wrote
Hi!
I just wrote a set of extension methods and related code (including a sample app) that helps log Result.Errors to an Microsoft.Extensions.Logging.ILogger.
To be sure, the logging code is rather opinionated, but I it think it'd be a useful addition, and might even want to adopt a bit of the code in Ardalis.Result, itself.
Thanks for sharing this great project. I use it every day!
That would be great. Would it make sense in the docs as a sample, were you thinking?
The real issue, I think, is whether or not you’ll like my opinionated approach to log structure.
I wrote the sample to make logging less ad-hoc and more structured, plus I need to do a lot of logging around Error results, using my custom LogResultErrors extension method.
logger.LogResultErrors( Result.Error(new ErrorList(["Oops!", "Whoopsie!"])), new Dictionary<string, string> { { "Code", "ABC123" }, { "Number", "987654321" } }, Guid.NewGuid());
Putting the code in docs as an example might be lengthy unless you decide to adopt some of the core code that the extension method uses.
The example uses Serilog to create output like the following.
[10:15:34.468 INF] ResultErrors={"Errors": ["Oops!", "Whoopsie!"]};Context={"CalledBy": "<Main>$", "CorrelationId": "f36a8fc7738d4c1e880f50c3fbb1926b", "ExtraInfo": {"Code": "ABC123", "Number": "987654321"}}
Anyway, I’ll submit a pull request but feel free to use it as you will and/or ask me to make any kind of changes
From: Steve Smith @.> Sent: Thursday, June 12, 2025 9:46 AM To: ardalis/Result @.> Cc: Louis S. Berman @.>; Author @.> Subject: Re: [ardalis/Result] I'd like to issue a PR for some sample code I just wrote (Issue #232)
[https://avatars.githubusercontent.com/u/782127?s=20&v=4]ardalis left a comment (ardalis/Result#232)https://github.com/ardalis/Result/issues/232#issuecomment-2966793757
That would be great. Would it make sense in the docs as a sample, were you thinking?
— Reply to this email directly, view it on GitHubhttps://github.com/ardalis/Result/issues/232#issuecomment-2966793757, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABACOHGXJSTYR6WHCOWSM7D3DGAAXAVCNFSM6AAAAAB7DOEI7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNRWG44TGNZVG4. You are receiving this because you authored the thread.Message ID: @.@.>>