serilog / serilog-sinks-email

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

Does this sink support expression templates? #114

Closed cryo75 closed 9 months ago

cryo75 commented 1 year ago

In my rolling file sink I have:

"Formatter": {
  "Type": "Serilog.Templates.ExpressionTemplate, Serilog.Expressions",
  "Template": "{@t:yyyy-MM-dd HH:mm:ss.fff zzz} [{@l:u3}]{#if SourceContext is not null} ({Substring(SourceContext, LastIndexOf(SourceContext, '.') + 1)}){#end} {@m:lj}\n{@x}"
},

Can the above also be used with the email sink out of the box?

nblumhardt commented 9 months ago

Could be some problems for overload resolution - try the 3.0.0-dev versions of the package, and pass the ExpressionTemplate in code I think. The overloads of WriteTo.Email need some work.