@@ -32,10 +32,10 @@ static void TextFormattingExample1()
32
32
. CreateLogger ( ) ;
33
33
34
34
log . Information ( "Running {Example}" , nameof ( TextFormattingExample1 ) ) ;
35
-
35
+
36
36
log . ForContext < Program > ( )
37
37
. Information ( "Cart contains {@Items}" , new [ ] { "Tea" , "Coffee" } ) ;
38
-
38
+
39
39
log . ForContext < Program > ( )
40
40
. Information ( "Cart contains {@Items}" , new [ ] { "Apricots" } ) ;
41
41
}
@@ -49,10 +49,10 @@ static void JsonFormattingExample()
49
49
. CreateLogger ( ) ;
50
50
51
51
log . Information ( "Running {Example}" , nameof ( JsonFormattingExample ) ) ;
52
-
52
+
53
53
log . ForContext < Program > ( )
54
54
. Information ( "Cart contains {@Items}" , new [ ] { "Tea" , "Coffee" } ) ;
55
-
55
+
56
56
log . ForContext < Program > ( )
57
57
. Warning ( "Cart is empty" ) ;
58
58
}
@@ -67,20 +67,20 @@ static void PipelineComponentExample()
67
67
. WriteTo . Console ( outputTemplate :
68
68
"[{Timestamp:HH:mm:ss} {Level:u3} ({SourceContext})] {Message:lj} (first item is {FirstItem}){NewLine}{Exception}" )
69
69
. CreateLogger ( ) ;
70
-
70
+
71
71
log . Information ( "Running {Example}" , nameof ( PipelineComponentExample ) ) ;
72
-
72
+
73
73
log . ForContext < Program > ( )
74
74
. Information ( "Cart contains {@Items}" , new [ ] { "Tea" , "Coffee" } ) ;
75
-
75
+
76
76
log . ForContext < Program > ( )
77
77
. Information ( "Cart contains {@Items}" , new [ ] { "Apricots" } ) ;
78
78
}
79
-
79
+
80
80
static void TextFormattingExample2 ( )
81
81
{
82
82
// Emulates `Microsoft.Extensions.Logging`'s `ConsoleLogger`.
83
-
83
+
84
84
var melon = new TemplateTheme ( TemplateTheme . Literate , new Dictionary < TemplateThemeStyle , string >
85
85
{
86
86
// `Information` is dark green in MEL.
@@ -102,11 +102,11 @@ static void TextFormattingExample2()
102
102
103
103
var program = log . ForContext < Program > ( ) ;
104
104
program . Information ( "Host listening at {ListenUri}" , "https://hello-world.local" ) ;
105
-
105
+
106
106
program
107
107
. ForContext ( "Scope" , new [ ] { "Main" , "TextFormattingExample2()" } )
108
108
. Information ( "HTTP {Method} {Path} responded {StatusCode} in {Elapsed:0.000} ms" , "GET" , "/api/hello" , 200 , 1.23 ) ;
109
-
109
+
110
110
program . Warning ( "We've reached the end of the line" ) ;
111
111
}
112
112
}
0 commit comments