diff --git a/src/Exceptionless/Exceptionless.csproj b/src/Exceptionless/Exceptionless.csproj
index 3c9c938f..177bcb10 100644
--- a/src/Exceptionless/Exceptionless.csproj
+++ b/src/Exceptionless/Exceptionless.csproj
@@ -34,6 +34,7 @@
+
diff --git a/src/Exceptionless/Extensions/ExceptionlessConfigurationExtensions.cs b/src/Exceptionless/Extensions/ExceptionlessConfigurationExtensions.cs
index 96272d13..2f469598 100644
--- a/src/Exceptionless/Extensions/ExceptionlessConfigurationExtensions.cs
+++ b/src/Exceptionless/Extensions/ExceptionlessConfigurationExtensions.cs
@@ -15,6 +15,10 @@
using Exceptionless.Storage;
using Exceptionless.Diagnostics;
+#if NETSTANDARD
+using Microsoft.Extensions.Configuration;
+#endif
+
#if NET45
using System.Configuration;
using Exceptionless.Extensions;
@@ -389,6 +393,86 @@ public static void ReadFromAppSettings(this ExceptionlessConfiguration config) {
}
#endif
+#if NETSTANDARD
+ ///
+ /// Sets the configuration from .net configuration settings.
+ ///
+ /// The configuration object you want to apply the settings to.
+ /// The configuration settings
+ public static void ReadFromConfiguration(this ExceptionlessConfiguration config, IConfiguration settings) {
+ if (config == null)
+ throw new ArgumentNullException(nameof(config));
+
+ if (settings == null)
+ throw new ArgumentNullException(nameof(settings));
+
+ var section = settings.GetSection("Exceptionless");
+ if (Boolean.TryParse(section["Enabled"], out bool enabled) && !enabled)
+ config.Enabled = false;
+
+ string apiKey = section["ApiKey"];
+ if (!String.IsNullOrEmpty(apiKey) && apiKey != "API_KEY_HERE")
+ config.ApiKey = apiKey;
+
+ string serverUrl = section["ServerUrl"];
+ if (!String.IsNullOrEmpty(serverUrl))
+ config.ServerUrl = serverUrl;
+
+ if (TimeSpan.TryParse(section["QueueMaxAge"], out var queueMaxAge))
+ config.QueueMaxAge = queueMaxAge;
+
+ if (Int32.TryParse(section["QueueMaxAttempts"], out int queueMaxAttempts))
+ config.QueueMaxAttempts = queueMaxAttempts;
+
+ string storagePath = section["StoragePath"];
+ if (!String.IsNullOrEmpty(storagePath))
+ config.Resolver.Register(typeof(IObjectStorage), () => new FolderObjectStorage(config.Resolver, storagePath));
+
+ string storageSerializer = section["StorageSerializer"];
+ if (!String.IsNullOrEmpty(storageSerializer)) {
+ try {
+ var serializerType = Type.GetType(storageSerializer);
+ if (!typeof(IStorageSerializer).GetTypeInfo().IsAssignableFrom(serializerType)) {
+ config.Resolver.GetLog().Error(typeof(ExceptionlessConfigurationExtensions), $"The storage serializer {storageSerializer} does not implemented interface {typeof(IStorageSerializer)}.");
+ }
+ else {
+ config.Resolver.Register(typeof(IStorageSerializer), serializerType);
+ }
+ }
+ catch (Exception ex) {
+ config.Resolver.GetLog().Error(typeof(ExceptionlessConfigurationExtensions), ex, $"The storage serializer {storageSerializer} type could not be resolved: ${ex.Message}");
+ }
+ }
+
+ if (Boolean.TryParse(section["EnableLogging"], out bool enableLogging) && enableLogging) {
+ string logPath = section["LogPath"];
+ if (!String.IsNullOrEmpty(logPath))
+ config.UseFileLogger(logPath);
+ else if (!String.IsNullOrEmpty(storagePath))
+ config.UseFileLogger(System.IO.Path.Combine(storagePath, "exceptionless.log"));
+ }
+
+ if (Boolean.TryParse(section["IncludePrivateInformation"], out bool includePrivateInformation) && !includePrivateInformation)
+ config.IncludePrivateInformation = false;
+
+ if (Boolean.TryParse(section["ProcessQueueOnCompletedRequest"], out bool processQueueOnCompletedRequest) && processQueueOnCompletedRequest)
+ config.ProcessQueueOnCompletedRequest = true;
+
+ foreach (var tag in section.GetSection("DefaultTags").GetChildren())
+ config.DefaultTags.Add(tag.Value);
+
+ foreach (var data in section.GetSection("DefaultData").GetChildren())
+ if (data.Value != null)
+ config.DefaultData[data.Key] = data.Value;
+
+ foreach (var setting in section.GetSection("Settings").GetChildren())
+ if (setting.Value != null)
+ config.Settings[setting.Key] = setting.Value;
+
+ // TODO: Support Registrations
+ }
+#endif
+
///
/// Reads the Exceptionless configuration from Environment Variables.
///
diff --git a/src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs b/src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs
index 7c98be28..0f400ca2 100644
--- a/src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs
+++ b/src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs
@@ -1,10 +1,5 @@
using System;
-using System.Reflection;
-using Exceptionless.Dependency;
using Exceptionless.Extensions.Hosting;
-using Exceptionless.Logging;
-using Exceptionless.Serializer;
-using Exceptionless.Storage;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -83,81 +78,5 @@ public static IServiceCollection AddExceptionless(this IServiceCollection servic
return client;
});
}
-
- ///
- /// Sets the configuration from .net configuration settings.
- ///
- /// The configuration object you want to apply the settings to.
- /// The configuration settings
- public static void ReadFromConfiguration(this ExceptionlessConfiguration config, IConfiguration settings) {
- if (config == null)
- throw new ArgumentNullException(nameof(config));
-
- if (settings == null)
- throw new ArgumentNullException(nameof(settings));
-
- var section = settings.GetSection("Exceptionless");
- if (Boolean.TryParse(section["Enabled"], out bool enabled) && !enabled)
- config.Enabled = false;
-
- string apiKey = section["ApiKey"];
- if (!String.IsNullOrEmpty(apiKey) && apiKey != "API_KEY_HERE")
- config.ApiKey = apiKey;
-
- string serverUrl = section["ServerUrl"];
- if (!String.IsNullOrEmpty(serverUrl))
- config.ServerUrl = serverUrl;
-
- if (TimeSpan.TryParse(section["QueueMaxAge"], out var queueMaxAge))
- config.QueueMaxAge = queueMaxAge;
-
- if (Int32.TryParse(section["QueueMaxAttempts"], out int queueMaxAttempts))
- config.QueueMaxAttempts = queueMaxAttempts;
-
- string storagePath = section["StoragePath"];
- if (!String.IsNullOrEmpty(storagePath))
- config.Resolver.Register(typeof(IObjectStorage), () => new FolderObjectStorage(config.Resolver, storagePath));
-
- string storageSerializer = section["StorageSerializer"];
- if (!String.IsNullOrEmpty(storageSerializer)) {
- try {
- var serializerType = Type.GetType(storageSerializer);
- if (!typeof(IStorageSerializer).GetTypeInfo().IsAssignableFrom(serializerType)) {
- config.Resolver.GetLog().Error(typeof(ExceptionlessConfigurationExtensions), $"The storage serializer {storageSerializer} does not implemented interface {typeof(IStorageSerializer)}.");
- } else {
- config.Resolver.Register(typeof(IStorageSerializer), serializerType);
- }
- } catch (Exception ex) {
- config.Resolver.GetLog().Error(typeof(ExceptionlessConfigurationExtensions), ex, $"The storage serializer {storageSerializer} type could not be resolved: ${ex.Message}");
- }
- }
-
- if (Boolean.TryParse(section["EnableLogging"], out bool enableLogging) && enableLogging) {
- string logPath = section["LogPath"];
- if (!String.IsNullOrEmpty(logPath))
- config.UseFileLogger(logPath);
- else if (!String.IsNullOrEmpty(storagePath))
- config.UseFileLogger(System.IO.Path.Combine(storagePath, "exceptionless.log"));
- }
-
- if (Boolean.TryParse(section["IncludePrivateInformation"], out bool includePrivateInformation) && !includePrivateInformation)
- config.IncludePrivateInformation = false;
-
- if (Boolean.TryParse(section["ProcessQueueOnCompletedRequest"], out bool processQueueOnCompletedRequest) && processQueueOnCompletedRequest)
- config.ProcessQueueOnCompletedRequest = true;
-
- foreach (var tag in section.GetSection("DefaultTags").GetChildren())
- config.DefaultTags.Add(tag.Value);
-
- foreach (var data in section.GetSection("DefaultData").GetChildren())
- if (data.Value != null)
- config.DefaultData[data.Key] = data.Value;
-
- foreach (var setting in section.GetSection("Settings").GetChildren())
- if (setting.Value != null)
- config.Settings[setting.Key] = setting.Value;
-
- // TODO: Support Registrations
- }
}
}
\ No newline at end of file