You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Templates are based on .NET format strings, and support standard padding, alignment, and format specifiers.
100
99
101
-
Along with standard properties for the event timestamp (`@t`), level (`@l`) and so on, "holes" in expression templates can include complex
102
-
expressions over the first-class properties of the event, like `{SourceContex}` and `{Cart[0]}` in the example..
100
+
Along with standard properties for the event timestamp (`@t`), level (`@l`) and so on, "holes" in expression templates can include complex
101
+
expressions over the first-class properties of the event, like `{SourceContext}` and `{Cart[0]}` in the example..
103
102
104
103
Templates support customizable color themes when used with the `Console` sink:
105
104
@@ -165,7 +164,7 @@ A typical set of operators is supported:
165
164
* Indexers `a['b']` and `a[0]`
166
165
* Wildcard indexing - `a[?]` any, and `a[*]` all
167
166
* Conditional `if a then b else c` (all branches required; see also the section below on _conditional blocks_)
168
-
167
+
169
168
Comparision operators that act on text all accept an optional postfix `ci` modifier to select case-insensitive comparisons:
170
169
171
170
```
@@ -176,7 +175,7 @@ User.Name like 'n%' ci
176
175
177
176
Functions are called using typical `Identifier(args)` syntax.
178
177
179
-
Except for the `IsDefined()` function, the result of
178
+
Except for the `IsDefined()` function, the result of
180
179
calling a function will be undefined if:
181
180
182
181
* any argument is undefined, or
@@ -223,10 +222,10 @@ Log.Logger = new LoggerConfiguration()
223
222
.WriteTo.Console(newExpressionTemplate(
224
223
"[{@t:HH:mm:ss} {@l:u3}{#if SourceContext is not null} ({SourceContext}){#end}] {@m}\n{@x}"))
225
224
.CreateLogger();
226
-
225
+
227
226
// Produces log events like:
228
227
// [21:21:45 INF] Starting up
229
-
// [21:21:46 INF (Sample.Program)] Firing engines
228
+
// [21:21:46 INF (Sample.Program)] Firing engines
230
229
```
231
230
232
231
The block between the `{#if <expr>}` and `{#end}` directives will only appear in the output if `<expr>` is `true` - in the example, events with a `SourceContext` include this in parentheses, while those without, don't.
@@ -302,7 +301,7 @@ ElementAt(@p, 'someName') ci
302
301
{ {Timestamp: @t, Username: User.Name} }\n
303
302
```
304
303
305
-
This output template shows the use of a space between the opening `{` of a hole, and the enclosed object literal with `Timestamp` and
304
+
This output template shows the use of a space between the opening `{` of a hole, and the enclosed object literal with `Timestamp` and
306
305
`Username` fields. The object will be formatted as JSON. The trailing `\n` is a C# or JSON newline literal (don't escape this any further, as
0 commit comments