FantasticFiasco / serilog-sinks-udp

A Serilog sink sending UDP packages over the network.
Apache License 2.0
30 stars 15 forks source link

.Trim() ruins OutputTemplate={NewLine} #73

Closed tagcode closed 4 years ago

tagcode commented 4 years ago

UdpSink calls .Trim() which removes {NewLine} behaviour and makes it impossible to formulate the message as the user wants.

github-actions[bot] commented 4 years ago

Hi there and welcome to this repository!

A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it.

FantasticFiasco commented 4 years ago

Correct me if I’m wrong, but it only removes all leading and trailing white-space characters. Is it a trailing whitespace that is removed in your application?

tagcode commented 4 years ago

Yes, trailing whitespace is removed. I'm using OutputTemplate="{EventId}{NewLine}" and capturing it with netcat in a bash script. The script cannot distinguish different lines because "{NewLine}" is consumed by the sender. Similarly, OutputTemplate="{Message}{NewLine}" also sends endless blocks of texts without linefeed.

FantasticFiasco commented 4 years ago

I'll look into it, cant remember why I added it, bit since changing it would be a breaking change I have to investigate it further.

tagcode commented 4 years ago

Okay. I suppose you considered packet boundary as equivalent information to whitespace/linefeed.

I think the options here are:

FantasticFiasco commented 4 years ago

A new major version with your fix is now available on nuget.org, you've also been mentioned in the changelog.

Thank you for reporting this!

tagcode commented 4 years ago

👍 Tried it and it works now exactly as in OutputTemplate. I appreciate.