File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 11using System . Linq ;
22using Serilog ;
3+ using Serilog . Sinks . Splunk ;
34
45namespace Sample
56{
@@ -27,13 +28,35 @@ public static void Main(string[] args)
2728 OverridingSourceType ( eventsToCreate ) ;
2829 OverridingHost ( eventsToCreate ) ;
2930 WithNoTemplate ( eventsToCreate ) ;
30-
31+ WithCompactSplunkFormatter ( eventsToCreate ) ;
3132 if ( runSSL )
3233 UsingSSL ( eventsToCreate ) ;
3334
3435 Log . Debug ( "Done" ) ;
3536 }
3637
38+ private static void WithCompactSplunkFormatter ( int eventsToCreate )
39+ {
40+ // Vanilla Test with full uri specified
41+ Log . Logger = new LoggerConfiguration ( )
42+ . MinimumLevel . Debug ( )
43+ . WriteTo . LiterateConsole ( )
44+ . WriteTo . EventCollector (
45+ "http://localhost:8088/services/collector" ,
46+ Program . EventCollectorToken , new CompactSplunkJsonFormatter ( ) )
47+ . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
48+ . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "Vanilla with CompactSplunkJsonFormatter specified" )
49+ . CreateLogger ( ) ;
50+
51+
52+ foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
53+ {
54+ Log . Information ( "{Counter}{Message}" , i , "Running vanilla loop with CompactSplunkJsonFormatter" ) ;
55+ }
56+
57+ Log . CloseAndFlush ( ) ;
58+ }
59+
3760 public static void OverridingSource ( int eventsToCreate )
3861 {
3962 // Override Source
You can’t perform that action at this time.
0 commit comments