serilog / serilog-sinks-email

A Serilog sink that writes events to SMTP email
Apache License 2.0
73 stars 68 forks source link

Support .NET Framework 40 #9

Closed normanhh3 closed 8 years ago

normanhh3 commented 9 years ago

I had a need to use Serilog on a project limited to the .NET Framework 4.0 at the present time. Recently I encountered some mechanisms to make managing multiple target framework versions easier to manage through changes to the MSBuild project files.

I have implemented a synchronous version of the functionality in the .NET Framework 4.0 and updated the associated build pieces to now output v4.0 and v4.5 assemblies. Thoughts and constructive criticism and feedback are expected. :-)

Suggestions on the best way to handle execution of the sink asynchronously in the 4.0 Framework are welcome. Suggestions I discussed with others so far are BCL support for async / await. I'm not experienced in that so at this point this is the best I've got.

nblumhardt commented 9 years ago

Hi Norman,

Great stuff - thanks!

I'm not sure the async version of this sink matters so much - the goal I believe was simply to get the email sending on a background thread (it can be slow) and this will still be the case when the synchronous version of EmitBatch() is used.

To complete this feature it'd be necessary to update Build.ps1 to run both configurations and package both into the .nupkg. Some of the other sinks are 4.0-compatible (e.g. see the Seq one) and might offer some clues as to how this is done.

Cheers!

normanhh3 commented 8 years ago

Ok, I can take a look at that and get back to you. On Oct 7, 2015 5:21 PM, "Nicholas Blumhardt" notifications@github.com wrote:

Hi Norman,

Great stuff - thanks!

I'm not sure the async version of this sink matters so much - the goal I believe was simply to get the email sending on a background thread (it can be slow) and this will still be the case when the synchronous version of EmitBatch() is used.

To complete this feature it'd be necessary to update Build.ps1 to run both configurations and package both into the .nupkg. Some of the other sinks are 4.0-compatible (e.g. see the Seq one) and might offer some clues as to how this is done.

Cheers!

— Reply to this email directly or view it on GitHub https://github.com/serilog/serilog-sinks-email/pull/9#issuecomment-146333291 .

normanhh3 commented 8 years ago

Didn't wind up needing to modify the existing Build.ps1 file after all. Just added the additional output files into the nuget package definition.

merbla commented 8 years ago

Hey @normanhh3 does this need #11 to get the desired result? Look at both now.

merbla commented 8 years ago

@normanhh3 can you also update the Serilog version (dependency) in the .nuspec to match that in the packages.config. Should be good to go after that.

normanhh3 commented 8 years ago

@merbla this change wasn't intended to be dependent on #11 at all. If you see something that indicates it is I can correct it. I just am not seeing the conflict at the moment. :-/

merbla commented 8 years ago

@normanhh3 sorry for the confusion. The change I mentioned in the nuspec was not related to #11.

Also, would you be able change the .nupsec to [1.5.11,2) to ensure compatibility with releases of core Serilog.

Thanks again for the PR.