Skip to content

Commit 8caf8cc

Browse files
author
Sergey Komisarchik
committed
sample update
1 parent 271949d commit 8caf8cc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

sample/Sample/Program.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using Serilog;
55
using System.IO;
66

7+
using Serilog.Core;
8+
79
namespace Sample
810
{
911
public class Program
@@ -21,7 +23,11 @@ public static void Main(string[] args)
2123

2224
do
2325
{
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();
2531
}
2632
while (Console.ReadKey().KeyChar != 'q');
2733
}

sample/Sample/appsettings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
}
1010
},
1111
"WriteTo": [
12-
{ "Name": "LiterateConsole" },
12+
{
13+
"Name": "LiterateConsole",
14+
"Args": {
15+
"outputTemplate": "[{Timestamp:HH:mm:ss} {SourceContext} [{Level}] {Message}{NewLine}{Exception}"
16+
}
17+
},
1318
{
1419
"Name": "File",
1520
"Args": {

0 commit comments

Comments
 (0)