-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathProgram.cs
50 lines (38 loc) · 1.21 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
static Logger ConfigureSerilog()
{
#region ConfigureSerilog
var configuration = new LoggerConfiguration();
configuration.Enrich.WithNsbExceptionDetails();
configuration.WriteTo.Seq("http://localhost:5341");
configuration.MinimumLevel.Information();
var logger = configuration.CreateLogger();
var serilogFactory = LogManager.Use<SerilogFactory>();
serilogFactory.WithLogger(logger);
#endregion
return logger;
}
Console.Title = "SeqSample";
var tracingLog = ConfigureSerilog();
#region UseConfig
var configuration = new EndpointConfiguration("SeqSample");
var serilogTracing = configuration.EnableSerilogTracing(tracingLog);
serilogTracing.EnableSagaTracing();
serilogTracing.EnableMessageTracing();
#endregion
configuration.UsePersistence<LearningPersistence>();
configuration.UseTransport<LearningTransport>();
var endpoint = await Endpoint.Start(configuration);
var createUser = new CreateUser
{
UserName = "jsmith",
FamilyName = "Smith",
GivenNames = "John"
};
await endpoint.SendLocal(createUser);
Console.WriteLine("Message sent");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
#region Cleanup
await endpoint.Stop();
Log.CloseAndFlush();
#endregion