diff --git a/Example/App.config b/Example/App.config
index 1bf6556..eb39ec8 100644
--- a/Example/App.config
+++ b/Example/App.config
@@ -8,4 +8,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Example/Example.csproj b/Example/Example.csproj
index a71fb35..edf25e8 100644
--- a/Example/Example.csproj
+++ b/Example/Example.csproj
@@ -34,25 +34,27 @@
4
-
- ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll
- True
+
+ ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
- ..\packages\Serilog.2.0.0\lib\net45\Serilog.dll
+ ..\packages\Serilog.2.8.0\lib\net45\Serilog.dll
-
- ..\packages\Serilog.Sinks.Stackify.2.0.2\lib\net45\Serilog.Sinks.Stackify.dll
+
+ ..\packages\Serilog.Sinks.Stackify.2.1.0\lib\net45\Serilog.Sinks.Stackify.dll
-
- ..\packages\StackifyLib.2.0.0\lib\net45\StackifyLib.dll
+
+ ..\packages\StackifyLib.2.1.4\lib\net45\StackifyLib.dll
+
+
+
diff --git a/Example/Program.cs b/Example/Program.cs
index e9deadc..36755e4 100644
--- a/Example/Program.cs
+++ b/Example/Program.cs
@@ -37,7 +37,7 @@ static void ConfigureLogging()
{
Log.Logger = new LoggerConfiguration()
.WriteTo
- .Stackify()
+ .Stackify("", "", "")
.CreateLogger();
}
}
diff --git a/Example/packages.config b/Example/packages.config
index 506b11c..cc50468 100644
--- a/Example/packages.config
+++ b/Example/packages.config
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/Serilog.Sinks.Stackify.sln b/Serilog.Sinks.Stackify.sln
index a2e3e4a..1d422ce 100644
--- a/Serilog.Sinks.Stackify.sln
+++ b/Serilog.Sinks.Stackify.sln
@@ -1,11 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26621.2
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28917.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{50C48CCC-8551-459A-A306-95D84DC3A422}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Stackify", "Serilog.Sinks.Stackify\Serilog.Sinks.Stackify.csproj", "{E44EC161-7AEF-40F1-9FFC-C98A3F105F23}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Sinks.Stackify", "Serilog.Sinks.Stackify\Serilog.Sinks.Stackify.csproj", "{E44EC161-7AEF-40F1-9FFC-C98A3F105F23}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/Serilog.Sinks.Stackify/LoggerConfigurationStackifyExtensions.cs b/Serilog.Sinks.Stackify/LoggerConfigurationStackifyExtensions.cs
index 26b3abc..f579cab 100644
--- a/Serilog.Sinks.Stackify/LoggerConfigurationStackifyExtensions.cs
+++ b/Serilog.Sinks.Stackify/LoggerConfigurationStackifyExtensions.cs
@@ -28,20 +28,27 @@ public static class LoggerConfigurationStackifyExtensions
/// Adds a sink that writes log events to the elmah.io webservice.
///
/// The logger configuration.
+ /// The api key provided by Stackify.
+ /// The name of your application.
+ /// The name of the environment, e.g. Dev / Prod / Stage etc.
/// Supplies culture-specific formatting information, or null.
/// The minimum log event level required in order to write an event to the sink. Set to Verbose by default.
/// Logger configuration, allowing configuration to continue.
/// A required parameter is null.
public static LoggerConfiguration Stackify(
this LoggerSinkConfiguration loggerConfiguration,
+ string apiKey,
+ string appName = "",
+ string environment = "",
IFormatProvider formatProvider = null,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum
)
- {
- if (loggerConfiguration == null) throw new ArgumentNullException("loggerConfiguration");
-
+ {
+ if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
+ if (string.IsNullOrWhiteSpace(apiKey)) throw new ArgumentNullException(nameof(apiKey));
+
return loggerConfiguration
- .Sink(new StackifySink(formatProvider), restrictedToMinimumLevel);
+ .Sink(new StackifySink(formatProvider, apiKey, appName, environment), restrictedToMinimumLevel);
}
}
}
diff --git a/Serilog.Sinks.Stackify/Serilog.Sinks.Stackify.csproj b/Serilog.Sinks.Stackify/Serilog.Sinks.Stackify.csproj
index 9b0a5db..ded3c60 100644
--- a/Serilog.Sinks.Stackify/Serilog.Sinks.Stackify.csproj
+++ b/Serilog.Sinks.Stackify/Serilog.Sinks.Stackify.csproj
@@ -1,9 +1,9 @@
-
+
- netstandard1.3;net45
+ netstandard2.0;net45
Serilog.Sinks.Stackify
- 2.0.2
+ 2.1.0
Serilog.Sinks.Stackify
Stackify
Serilog Stackify Sink
@@ -19,18 +19,18 @@
Serilog.Sinks.Stackify
Serilog.Sinks.Stackify
true
- 2.0.0.0
- 2.0.0.0
+ 2.1.0.0
+ 2.1.0.0
-
-
-
+
+
+
-
-
+
+
diff --git a/Serilog.Sinks.Stackify/Sinks/Stackify/StackifySink.cs b/Serilog.Sinks.Stackify/Sinks/Stackify/StackifySink.cs
index 7d0e964..c923198 100644
--- a/Serilog.Sinks.Stackify/Sinks/Stackify/StackifySink.cs
+++ b/Serilog.Sinks.Stackify/Sinks/Stackify/StackifySink.cs
@@ -27,18 +27,28 @@ public class StackifySink : ILogEventSink, IDisposable
{
private readonly ErrorGovernor _Governor = new ErrorGovernor();
private readonly IFormatProvider _formatProvider;
+ private readonly string _apiKey;
+ private readonly string _appName;
+ private readonly string _environment;
private readonly JsonDataFormatter _dataFormatter;
private LogClient _logClient = null;
///
/// Construct a sink that saves logs to the specified storage account.
///
- public StackifySink(IFormatProvider formatProvider)
+ public StackifySink(IFormatProvider formatProvider, string apiKey, string appName, string environment)
{
_formatProvider = formatProvider;
+ _apiKey = apiKey;
+ _appName = appName;
+ _environment = environment;
_dataFormatter = new JsonDataFormatter();
_logClient = new LogClient("StackifyLib.net-serilog", null, null);
+
+ Config.ApiKey = apiKey;
+ Config.AppName = appName;
+ Config.Environment = environment;
}