11using System . Linq ;
2- using System . Threading ;
32using Serilog ;
4- using Serilog . Core ;
53
64namespace Sample
75{
8- ///
9- /// Sample 10 false
10- ///
116 public class Program
127 {
138 public static string EventCollectorToken = "2B94855F-1184-46F7-BFF1-56A3112F627E" ;
14-
9+
1510 public static void Main ( string [ ] args )
1611 {
1712 var eventsToCreate = 100 ;
1813 var runSSL = false ;
19-
20- if ( args . Length > 0 )
21- eventsToCreate = int . Parse ( args [ 0 ] ) ;
22-
23- if ( args . Length == 2 )
24- runSSL = bool . Parse ( args [ 1 ] ) ;
14+
15+ if ( args . Length > 0 )
16+ eventsToCreate = int . Parse ( args [ 0 ] ) ;
17+
18+ if ( args . Length == 2 )
19+ runSSL = bool . Parse ( args [ 1 ] ) ;
2520
2621 Log . Information ( "Sample starting up" ) ;
2722 Serilog . Debugging . SelfLog . Enable ( System . Console . Out ) ;
@@ -33,9 +28,9 @@ public static void Main(string[] args)
3328 OverridingHost ( eventsToCreate ) ;
3429 WithNoTemplate ( eventsToCreate ) ;
3530
36- if ( runSSL )
31+ if ( runSSL )
3732 UsingSSL ( eventsToCreate ) ;
38-
33+
3934 Log . Debug ( "Done" ) ;
4035 }
4136
@@ -44,15 +39,15 @@ public static void OverridingSource(int eventsToCreate)
4439 // Override Source
4540 Log . Logger = new LoggerConfiguration ( )
4641 . MinimumLevel . Debug ( )
47- . WriteTo . LiterateConsole ( )
42+ . WriteTo . LiterateConsole ( )
4843 . WriteTo . EventCollector (
49- "http://localhost:8088" ,
44+ "http://localhost:8088" ,
5045 Program . EventCollectorToken ,
5146 source : "Serilog.Sinks.Splunk.Sample.TestSource" )
5247 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
5348 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "Source Override" )
5449 . CreateLogger ( ) ;
55-
50+
5651 foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
5752 {
5853 Log . Information ( "Running source override loop {Counter}" , i ) ;
@@ -67,15 +62,15 @@ public static void OverridingSourceType(int eventsToCreate)
6762 // Override Source
6863 Log . Logger = new LoggerConfiguration ( )
6964 . MinimumLevel . Debug ( )
70- . WriteTo . LiterateConsole ( )
65+ . WriteTo . LiterateConsole ( )
7166 . WriteTo . EventCollector (
72- "http://localhost:8088" ,
67+ "http://localhost:8088" ,
7368 Program . EventCollectorToken ,
7469 sourceType : "Serilog.Sinks.Splunk.Sample.TestSourceType" )
7570 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
7671 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "Source Type Override" )
7772 . CreateLogger ( ) ;
78-
73+
7974 foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
8075 {
8176 Log . Information ( "Running source type override loop {Counter}" , i ) ;
@@ -90,15 +85,15 @@ public static void OverridingHost(int eventsToCreate)
9085 // Override Host
9186 Log . Logger = new LoggerConfiguration ( )
9287 . MinimumLevel . Debug ( )
93- . WriteTo . LiterateConsole ( )
88+ . WriteTo . LiterateConsole ( )
9489 . WriteTo . EventCollector (
95- "http://localhost:8088" ,
90+ "http://localhost:8088" ,
9691 Program . EventCollectorToken ,
9792 host : "myamazingmachine" )
9893 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
9994 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "Host Override" )
10095 . CreateLogger ( ) ;
101-
96+
10297 foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
10398 {
10499 Log . Information ( "Running host override loop {Counter}" , i ) ;
@@ -113,7 +108,7 @@ public static void UsingFullUri(int eventsToCreate)
113108 // Vanilla Test with full uri specified
114109 Log . Logger = new LoggerConfiguration ( )
115110 . MinimumLevel . Debug ( )
116- . WriteTo . LiterateConsole ( )
111+ . WriteTo . LiterateConsole ( )
117112 . WriteTo . EventCollector (
118113 "http://localhost:8088/services/collector" ,
119114 Program . EventCollectorToken )
@@ -135,13 +130,13 @@ public static void UsingHostOnly(int eventsToCreate)
135130 // Vanilla Tests just host
136131 Log . Logger = new LoggerConfiguration ( )
137132 . MinimumLevel . Debug ( )
138- . WriteTo . LiterateConsole ( )
133+ . WriteTo . LiterateConsole ( )
139134 . WriteTo . EventCollector (
140135 "http://localhost:8088" ,
141136 Program . EventCollectorToken )
142137 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
143138 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "Vanilla No services/collector in uri" )
144- . CreateLogger ( ) ;
139+ . CreateLogger ( ) ;
145140
146141 foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
147142 {
@@ -156,15 +151,15 @@ public static void WithNoTemplate(int eventsToCreate)
156151 // No Template
157152 Log . Logger = new LoggerConfiguration ( )
158153 . MinimumLevel . Debug ( )
159- . WriteTo . LiterateConsole ( )
154+ . WriteTo . LiterateConsole ( )
160155 . WriteTo . EventCollector (
161- "http://localhost:8088" ,
156+ "http://localhost:8088" ,
162157 Program . EventCollectorToken ,
163158 renderTemplate : false )
164159 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
165160 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "No Templates" )
166161 . CreateLogger ( ) ;
167-
162+
168163 foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
169164 {
170165 Log . Information ( "Running no template loop {Counter}" , i ) ;
@@ -178,14 +173,14 @@ public static void UsingSSL(int eventsToCreate)
178173 // SSL
179174 Log . Logger = new LoggerConfiguration ( )
180175 . MinimumLevel . Debug ( )
181- . WriteTo . LiterateConsole ( )
176+ . WriteTo . LiterateConsole ( )
182177 . WriteTo . EventCollector (
183178 "https://localhost:8088" ,
184179 Program . EventCollectorToken )
185180 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample" , "ViaEventCollector" )
186181 . Enrich . WithProperty ( "Serilog.Sinks.Splunk.Sample.TestType" , "HTTPS" )
187- . CreateLogger ( ) ;
188-
182+ . CreateLogger ( ) ;
183+
189184 foreach ( var i in Enumerable . Range ( 0 , eventsToCreate ) )
190185 {
191186 Log . Information ( "HTTPS {Counter}" , i ) ;
0 commit comments