File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed
Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change 66 </PropertyGroup >
77
88 <ItemGroup >
9- <PackageReference Include =" Serilog" Version =" 2.8 .0" />
10- <PackageReference Include =" Serilog.Sinks.RabbitMQ" Version =" 2 .0.2 " />
11- <PackageReference Include =" Serilog.Formatting.Compact" Version =" 1 .0.0" />
9+ <PackageReference Include =" Serilog" Version =" 4.3 .0" />
10+ <PackageReference Include =" Serilog.Sinks.RabbitMQ" Version =" 8 .0.0 " />
11+ <PackageReference Include =" Serilog.Formatting.Compact" Version =" 3 .0.0" />
1212 </ItemGroup >
1313
1414</Project >
Original file line number Diff line number Diff line change 11using System . Threading ;
22using Serilog ;
33using Serilog . Formatting . Compact ;
4- using Serilog . Sinks . RabbitMQ . Sinks . RabbitMQ ;
5-
6- var rmq = new RabbitMQConfiguration
7- {
8- Hostname = "localhost" ,
9- Username = "guest" ,
10- Password = "guest" ,
11- Exchange = "" ,
12- RouteKey = "logs"
13- } ;
144
155Log . Logger = new LoggerConfiguration ( )
166 . Enrich . WithProperty ( "Application" , "Demo" )
17- . WriteTo . RabbitMQ ( rmq , new CompactJsonFormatter ( ) )
7+ . WriteTo . RabbitMQ ( ( client , sink ) =>
8+ {
9+ client . Hostnames . Add ( "localhost" ) ;
10+ client . Username = "guest" ;
11+ client . Password = "guest" ;
12+ client . Exchange = "" ;
13+ client . RoutingKey = "logs" ;
14+ sink . TextFormatter = new CompactJsonFormatter ( ) ;
15+ } )
1816 . CreateLogger ( ) ;
1917
2018while ( true )
You can’t perform that action at this time.
0 commit comments