Skip to content

Commit

Permalink
Merge pull request #55 from avireddy02/dev
Browse files Browse the repository at this point in the history
Sample for CompactSplunkJsonFormatter
  • Loading branch information
merbla authored May 26, 2017
2 parents a6b73fa + 89454c2 commit c157e45
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion sample/Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Serilog;
using Serilog.Sinks.Splunk;

namespace Sample
{
Expand Down Expand Up @@ -27,13 +28,35 @@ public static void Main(string[] args)
OverridingSourceType(eventsToCreate);
OverridingHost(eventsToCreate);
WithNoTemplate(eventsToCreate);

WithCompactSplunkFormatter(eventsToCreate);
if (runSSL)
UsingSSL(eventsToCreate);

Log.Debug("Done");
}

private static void WithCompactSplunkFormatter(int eventsToCreate)
{
// Vanilla Test with full uri specified
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088/services/collector",
Program.EventCollectorToken,new CompactSplunkJsonFormatter())
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla with CompactSplunkJsonFormatter specified")
.CreateLogger();


foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("{Counter}{Message}", i, "Running vanilla loop with CompactSplunkJsonFormatter");
}

Log.CloseAndFlush();
}

public static void OverridingSource(int eventsToCreate)
{
// Override Source
Expand Down

0 comments on commit c157e45

Please sign in to comment.