Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.5.0 #81

Merged
merged 4 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions sample/Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net47</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">
<Reference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>The Splunk Sink for Serilog</Description>
<VersionPrefix>2.4.0</VersionPrefix>
<VersionPrefix>2.5.0</VersionPrefix>
<Authors>Matthew Erbs, Serilog Contributors</Authors>
<TargetFrameworks>net45;netstandard1.1;netstandard1.3</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -15,29 +15,29 @@
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
<DefineConstants>$(DefineConstants);TCP;UDP</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<PackageReference Include="Splunk.Logging.Common" Version="1.6.0" />
<Reference Include="System.Net.Http" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
<DefineConstants>$(DefineConstants);TCP;UDP</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
<PackageReference Include="System.Net.Http" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Net.Http" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.5.0" />
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="2.1.1" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

</Project>
21 changes: 14 additions & 7 deletions src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System;
using System.Net.Http;
using Serilog.Configuration;
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Sinks.Splunk;
Expand Down Expand Up @@ -53,6 +54,7 @@ public static class SplunkLoggingConfigurationExtensions
/// <param name="batchIntervalInSeconds">The interval in seconds that the queue should be instpected for batching</param>
/// <param name="batchSizeLimit">The size of the batch</param>
/// <param name="messageHandler">The handler used to send HTTP requests</param>
/// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param>
/// <returns></returns>
public static LoggerConfiguration EventCollector(
this LoggerSinkConfiguration configuration,
Expand All @@ -69,7 +71,8 @@ public static LoggerConfiguration EventCollector(
bool renderTemplate = true,
int batchIntervalInSeconds = 2,
int batchSizeLimit = 100,
HttpMessageHandler messageHandler = null)
HttpMessageHandler messageHandler = null,
LoggingLevelSwitch levelSwitch = null)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
Expand All @@ -88,7 +91,7 @@ public static LoggerConfiguration EventCollector(
renderTemplate,
messageHandler);

return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel);
return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel, levelSwitch);
}

/// <summary>
Expand All @@ -104,6 +107,7 @@ public static LoggerConfiguration EventCollector(
/// <param name="batchIntervalInSeconds">The interval in seconds that the queue should be instpected for batching</param>
/// <param name="batchSizeLimit">The size of the batch</param>
/// <param name="messageHandler">The handler used to send HTTP requests</param>
/// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param>
/// <returns></returns>
public static LoggerConfiguration EventCollector(
this LoggerSinkConfiguration configuration,
Expand All @@ -115,7 +119,8 @@ public static LoggerConfiguration EventCollector(
string outputTemplate = DefaultOutputTemplate,
int batchIntervalInSeconds = 2,
int batchSizeLimit = 100,
HttpMessageHandler messageHandler = null)
HttpMessageHandler messageHandler = null,
LoggingLevelSwitch levelSwitch = null)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
if (jsonFormatter == null) throw new ArgumentNullException(nameof(jsonFormatter));
Expand All @@ -130,10 +135,10 @@ public static LoggerConfiguration EventCollector(
jsonFormatter,
messageHandler);

return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel);
return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel, levelSwitch);
}


/// <summary>
/// Adds a sink that writes log events as to a Splunk instance via the HTTP Event Collector.
/// </summary>
Expand All @@ -152,6 +157,7 @@ public static LoggerConfiguration EventCollector(
/// <param name="batchIntervalInSeconds">The interval in seconds that the queue should be instpected for batching</param>
/// <param name="batchSizeLimit">The size of the batch</param>
/// <param name="messageHandler">The handler used to send HTTP requests</param>
/// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param>
/// <param name="fields">Customfields that will be indexed in splunk with this event</param>
/// <returns></returns>
public static LoggerConfiguration EventCollector(
Expand All @@ -170,7 +176,8 @@ public static LoggerConfiguration EventCollector(
bool renderTemplate = true,
int batchIntervalInSeconds = 2,
int batchSizeLimit = 100,
HttpMessageHandler messageHandler = null)
HttpMessageHandler messageHandler = null,
LoggingLevelSwitch levelSwitch = null)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
Expand All @@ -191,7 +198,7 @@ public static LoggerConfiguration EventCollector(
messageHandler
);

return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel);
return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel, levelSwitch);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,23 @@
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Sinks.Splunk\Serilog.Sinks.Splunk.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
<PackageReference Include="System.Net.Http" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Net.Http" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup>
Expand Down