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 1
1
using System . Linq ;
2
2
using Serilog ;
3
+ using Serilog . Sinks . Splunk ;
3
4
4
5
namespace Sample
5
6
{
@@ -27,13 +28,35 @@ public static void Main(string[] args)
27
28
OverridingSourceType ( eventsToCreate ) ;
28
29
OverridingHost ( eventsToCreate ) ;
29
30
WithNoTemplate ( eventsToCreate ) ;
30
-
31
+ WithCompactSplunkFormatter ( eventsToCreate ) ;
31
32
if ( runSSL )
32
33
UsingSSL ( eventsToCreate ) ;
33
34
34
35
Log . Debug ( "Done" ) ;
35
36
}
36
37
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
+
37
60
public static void OverridingSource ( int eventsToCreate )
38
61
{
39
62
// Override Source
You can’t perform that action at this time.
0 commit comments