serilog-formatting-compact-reader icon indicating copy to clipboard operation
serilog-formatting-compact-reader copied to clipboard

Add support for async reads

Open augustoproiete opened this issue 4 years ago • 2 comments

Closes #24

augustoproiete avatar Nov 06 '20 04:11 augustoproiete

Thanks for the PR!

I've spent a bit of time with <Nullable>enable</..> recently, and wonder if (since LogEvent is a class), the better option here might be just:

public async Task<LogEvent?> TryReadAsync()

With null checking, this ends up "safe" (or a little safer than the earlier options, anyway), so I suspect that this will end up being the norm in future APIs.

What do you think?

nblumhardt avatar Nov 08 '20 22:11 nblumhardt

Thanks for reviewing, Nick. I generally agree that for this API, returning an NRT would make sense as there's no other meaning for null in this case, and would be "safe" as you said.

I actually didn't think NRT was an option for libraries that still target .NET Framework, but after your comment I read more about it, it doesn't seem it's a big issue anymore (if it ever were), just not the same experience/same warnings you'd get on .NET Core/.NET5.

I'll give it a go and see what the experience is like consuming APIs that use NRTs from net45, net48, netstandard2.0 projects and get back to you.

ps: I'm assuming we're still support net45 and netstandard1.x for the time being.

augustoproiete avatar Nov 12 '20 01:11 augustoproiete

Hey @augustoproiete! I'm thinking about picking this one up, let me know if you're still keen to work on it, but guessing with the long time passed and current commitments that this is probably stale now :-) 👋

nblumhardt avatar Jul 02 '24 21:07 nblumhardt

Hey @nblumhardt looks like I forgot about this one 😄. If you have spare cycles now feel free to takeover, otherwise I'll come back in a few weeks during summer break

augustoproiete avatar Jul 04 '24 19:07 augustoproiete

@augustoproiete @nblumhardt

Just bumping as I would find this very useful. I am writing a log viewer in Blazor (which I am thinking about making open source)

Thanks for the work on this 👍

digitaldirk avatar Jul 15 '24 19:07 digitaldirk

Now covered by #43 - thanks @augustoproiete :wave:

nblumhardt avatar Jul 16 '24 06:07 nblumhardt