File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 4
4
using Serilog ;
5
5
using System . IO ;
6
6
7
+ using Serilog . Core ;
8
+
7
9
namespace Sample
8
10
{
9
11
public class Program
@@ -21,7 +23,11 @@ public static void Main(string[] args)
21
23
22
24
do
23
25
{
24
- logger . Information ( "Hello, world!" ) ;
26
+ logger . ForContext < Program > ( ) . Information ( "Hello, world!" ) ;
27
+ logger . ForContext ( Constants . SourceContextPropertyName , "Microsoft" ) . Warning ( "Hello, world!" ) ;
28
+ logger . ForContext ( Constants . SourceContextPropertyName , "MyApp.Something.Tricky" ) . Verbose ( "Hello, world!" ) ;
29
+
30
+ Console . WriteLine ( ) ;
25
31
}
26
32
while ( Console . ReadKey ( ) . KeyChar != 'q' ) ;
27
33
}
Original file line number Diff line number Diff line change 9
9
}
10
10
},
11
11
"WriteTo" : [
12
- { "Name" : " LiterateConsole" },
12
+ {
13
+ "Name" : " LiterateConsole" ,
14
+ "Args" : {
15
+ "outputTemplate" : " [{Timestamp:HH:mm:ss} {SourceContext} [{Level}] {Message}{NewLine}{Exception}"
16
+ }
17
+ },
13
18
{
14
19
"Name" : " File" ,
15
20
"Args" : {
You can’t perform that action at this time.
0 commit comments