Closed
Description
It'd be nice to be able to conditionally include parts of the template:
"[{@t:HH:mm:ss} {@l:u3}{#if SourceContext is not null} ({SourceContext}){#end}] {@m}\n{@x}"
This would need to be added with consideration of both conditions and repetition. Unfortunately the if
/then
/else
form in the expression grammar is too rigid to work well in this role, and lacks an 'end' marker.
As long as we're happy with a bit of divergence between the preprocessor-like #directive
syntax and the regular expression syntax, I think we'd support at least:
{#if <condition>} ... {#else if <condition>} ... {#else} ... {#end}
{#each <name> in <sequence>} ... {#end}
{#each <name>, <value> in <structure>} ... {#end}
For logging to the console, this would open up the possibility of better display of the ASP.NET Core Scope
property, and variations like structured properties on indented trailing lines.
There are a few additions we could consider down the track - #each
/#else
/#end
immediately comes to mind.