diff --git a/Src/CoreConsoleApp/CoreConsoleApp.csproj b/Src/CoreConsoleApp/CoreConsoleApp.csproj index c8ad429..1edda3d 100644 --- a/Src/CoreConsoleApp/CoreConsoleApp.csproj +++ b/Src/CoreConsoleApp/CoreConsoleApp.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + netcoreapp2.0;net461 CoreConsoleApp Exe CoreConsoleApp @@ -27,11 +27,11 @@ - + NETCORE - + NETFULL diff --git a/Src/CoreConsoleApp/Program.cs b/Src/CoreConsoleApp/Program.cs index e08a559..9a1e940 100644 --- a/Src/CoreConsoleApp/Program.cs +++ b/Src/CoreConsoleApp/Program.cs @@ -17,9 +17,6 @@ namespace CoreConsoleApp { public class Program { - - - static void Main(string[] args) { var builder = new ConfigurationBuilder() diff --git a/Src/StackifyLib.AspNetCore/Configure.cs b/Src/StackifyLib.AspNetCore/Configure.cs index 169724a..353070b 100644 --- a/Src/StackifyLib.AspNetCore/Configure.cs +++ b/Src/StackifyLib.AspNetCore/Configure.cs @@ -1,25 +1,22 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using StackifyLib.Models; namespace StackifyLib.AspNetCore { internal class Configure { - internal static IServiceProvider ServiceProvider { get; set; } internal static void SubscribeToWebRequestDetails(IServiceProvider serviceProvider) { if (ServiceProvider != null) + { return; + } ServiceProvider = serviceProvider; WebRequestDetail.SetWebRequestDetail += WebRequestDetailMapper.WebRequestDetail_SetWebRequestDetail; } } - -} +} \ No newline at end of file diff --git a/Src/StackifyLib.AspNetCore/Extensions.cs b/Src/StackifyLib.AspNetCore/Extensions.cs index 646c574..f26bcf2 100644 --- a/Src/StackifyLib.AspNetCore/Extensions.cs +++ b/Src/StackifyLib.AspNetCore/Extensions.cs @@ -1,19 +1,12 @@ using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; using StackifyLib.AspNetCore; namespace StackifyLib { public static class Extensions { - - - - public static void ConfigureStackifyLogging(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, - Microsoft.Extensions.Configuration.IConfigurationRoot configuration) + public static void ConfigureStackifyLogging(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.Extensions.Configuration.IConfigurationRoot configuration) { try { @@ -29,8 +22,8 @@ public static void ConfigureStackifyLogging(this Microsoft.AspNetCore.Builder.IA } catch (Exception ex) { - Debug.WriteLine("Error in AddStackifyLogging " + ex.ToString()); + Debug.WriteLine($"Error in ConfigureStackifyLogging {ex}"); } } } -} +} \ No newline at end of file diff --git a/Src/StackifyLib.AspNetCore/StackifyLib.AspNetCore.csproj b/Src/StackifyLib.AspNetCore/StackifyLib.AspNetCore.csproj index e22709d..6914bcb 100644 --- a/Src/StackifyLib.AspNetCore/StackifyLib.AspNetCore.csproj +++ b/Src/StackifyLib.AspNetCore/StackifyLib.AspNetCore.csproj @@ -2,15 +2,15 @@ StackifyLib for AspNetCore - 2.0.0 - netstandard2.0 + 2.1.0 + netstandard2.0;net461;net462 StackifyLib.AspNetCore StackifyLib.AspNetCore stackify;metrics;errors;logs false false false - 2.1.0 + 2.1.1 StackifyLib.AspNetCore https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE https://github.com/stackify/stackify-api-dotnet diff --git a/Src/StackifyLib.AspNetCore/WebRequestDetailMapper.cs b/Src/StackifyLib.AspNetCore/WebRequestDetailMapper.cs index 8879e25..c6944fb 100644 --- a/Src/StackifyLib.AspNetCore/WebRequestDetailMapper.cs +++ b/Src/StackifyLib.AspNetCore/WebRequestDetailMapper.cs @@ -1,12 +1,11 @@ -using StackifyLib.Models; -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Primitives; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Primitives; +using StackifyLib.Models; namespace StackifyLib.AspNetCore { @@ -22,7 +21,9 @@ internal static void WebRequestDetail_SetWebRequestDetail(WebRequestDetail detai var context = Configure.ServiceProvider?.GetService()?.HttpContext; if (context == null) + { return; + } Load(context, detail); } @@ -30,59 +31,33 @@ internal static void WebRequestDetail_SetWebRequestDetail(WebRequestDetail detai private static void Load(HttpContext context, WebRequestDetail detail) { if (context == null || context.Request == null) + { return; + } - HttpRequest request = context.Request; + var request = context.Request; try { detail.HttpMethod = request.Method; - - detail.UserIPAddress = context?.Connection?.RemoteIpAddress?.ToString(); - - - //if (context.Items != null && context.Items.Contains("Stackify.ReportingUrl")) - //{ - // ReportingUrl = context.Items["Stackify.ReportingUrl"].ToString(); - //} - - - if (request.IsHttps) - { - detail.RequestProtocol = "https"; - } - else - { - detail.RequestProtocol = "http"; - } - detail.RequestUrl = detail.RequestProtocol + "//" + request.Host + request.Path; - - + detail.UserIPAddress = context.Connection?.RemoteIpAddress?.ToString(); + detail.RequestProtocol = request.IsHttps ? "https" : "http"; + detail.RequestUrl = $"{detail.RequestProtocol}//{request.Host}{request.Path}"; detail.MVCAction = context.GetRouteValue("action")?.ToString(); detail.MVCController = context.GetRouteValue("controller")?.ToString(); - if (!string.IsNullOrEmpty(detail.MVCAction) && !string.IsNullOrEmpty(detail.MVCController)) + if (string.IsNullOrEmpty(detail.MVCAction) == false && string.IsNullOrEmpty(detail.MVCController) == false) { - detail.ReportingUrl = detail.MVCController + "." + detail.MVCAction; + detail.ReportingUrl = $"{detail.MVCController}.{detail.MVCAction}"; } - - - //if (request.AppRelativeCurrentExecutionFilePath != null) - //{ - // RequestUrlRoot = request.AppRelativeCurrentExecutionFilePath.TrimStart('~'); - //} - } catch (Exception) { - + // ignored } - - try { - if (request.QueryString != null) { detail.QueryString = ToKeyValues(request.Query, null, null); @@ -95,12 +70,12 @@ private static void Load(HttpContext context, WebRequestDetail detail) Config.ErrorHeaderBadKeys = new List(); } - if (!Config.ErrorHeaderBadKeys.Contains("cookie")) + if (Config.ErrorHeaderBadKeys.Contains("cookie") == false) { Config.ErrorHeaderBadKeys.Add("cookie"); } - if (!Config.ErrorHeaderBadKeys.Contains("authorization")) + if (Config.ErrorHeaderBadKeys.Contains("authorization") == false) { Config.ErrorHeaderBadKeys.Add("authorization"); } @@ -117,66 +92,33 @@ private static void Load(HttpContext context, WebRequestDetail detail) { detail.PostData = ToKeyValues(request.Form, null, null); } - - //sessions return a byte array... - //if (context.Session != null && Config.CaptureSessionVariables && Config.ErrorSessionGoodKeys.Any()) - //{ - // SessionData = new Dictionary(); - - // foreach (var key in Config.ErrorSessionGoodKeys) - // { - // SessionData[key] = context.Session - // } - - - //} - - //if (Config.CaptureErrorPostdata) - //{ - // var contentType = context.Request.Headers["Content-Type"]; - - // if (contentType != "text/html" && contentType != "application/x-www-form-urlencoded" && - // context.Request.RequestType != "GET") - // { - // int length = 4096; - // string postBody = new StreamReader(context.Request.InputStream).ReadToEnd(); - // if (postBody.Length < length) - // { - // length = postBody.Length; - // } - - // PostDataRaw = postBody.Substring(0, length); - // } - //} } catch (Exception) { + // ignored } } - //IEnumerable> - //IEnumerable> internal static Dictionary ToKeyValues(IEnumerable> collection, List goodKeys, List badKeys) { - //var keys = collection.Keys; var items = new Dictionary(); - foreach (var item in collection) + foreach (KeyValuePair item in collection) { - string key = item.Key; + var key = item.Key; + try { object val = item.Value.ToString(); - if (val != null && !string.IsNullOrWhiteSpace(val.ToString()) && items.ContainsKey(key)) + if (val != null && string.IsNullOrWhiteSpace(val.ToString()) == false && items.ContainsKey(key)) { AddKey(key, val.ToString(), items, goodKeys, badKeys); } - } catch (Exception) { - + // ignored } } @@ -185,25 +127,24 @@ internal static Dictionary ToKeyValues(IEnumerable ToKeyValues(IEnumerable> collection, List goodKeys, List badKeys) { - //var keys = collection.Keys; var items = new Dictionary(); - foreach (var item in collection) + foreach (KeyValuePair item in collection) { - string key = item.Key; + var key = item.Key; + try { object val = item.Value; - if (val != null && !string.IsNullOrWhiteSpace(val.ToString()) && items.ContainsKey(key)) + if (val != null && string.IsNullOrWhiteSpace(val.ToString()) == false && items.ContainsKey(key)) { AddKey(key, val.ToString(), items, goodKeys, badKeys); } - } catch (Exception) { - + // ignored } } @@ -218,9 +159,10 @@ internal static void AddKey(string key, string value, Dictionary dictionary[key] = "X-MASKED-X"; return; } + //if not in the good key list, return //if good key list is empty, we let it take it - else if (goodKeys != null && goodKeys.Any() && !goodKeys.Any(x => x.Equals(key, StringComparison.CurrentCultureIgnoreCase))) + if (goodKeys != null && goodKeys.Any() && goodKeys.Any(x => x.Equals(key, StringComparison.CurrentCultureIgnoreCase)) == false) { return; } @@ -228,4 +170,4 @@ internal static void AddKey(string key, string value, Dictionary dictionary[key] = value; } } -} +} \ No newline at end of file diff --git a/Src/StackifyLib.CoreLogger/LoggingExtensions.cs b/Src/StackifyLib.CoreLogger/LoggingExtensions.cs index 0bca874..7fc834c 100644 --- a/Src/StackifyLib.CoreLogger/LoggingExtensions.cs +++ b/Src/StackifyLib.CoreLogger/LoggingExtensions.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; namespace StackifyLib.CoreLogger @@ -11,10 +8,12 @@ public static class LoggingExtensions public static ILoggerFactory AddStackify(this ILoggerFactory factory, ILogger logger = null, bool dispose = false) { if (factory == null) + { throw new ArgumentNullException("factory"); + } - factory.AddProvider((ILoggerProvider)new StackifyLoggerProvider()); + factory.AddProvider(new StackifyLoggerProvider()); return factory; } } -} +} \ No newline at end of file diff --git a/Src/StackifyLib.CoreLogger/StackifyLib.CoreLogger.csproj b/Src/StackifyLib.CoreLogger/StackifyLib.CoreLogger.csproj index 09d9f0f..3d15643 100644 --- a/Src/StackifyLib.CoreLogger/StackifyLib.CoreLogger.csproj +++ b/Src/StackifyLib.CoreLogger/StackifyLib.CoreLogger.csproj @@ -2,8 +2,8 @@ Stackify .NET Core LoggerFactory - 2.0.0 - netstandard2.0 + 2.1.0 + netstandard2.0;net461;net462 StackifyLib.CoreLogger StackifyLib.CoreLogger stackify;metrics;errors;logs @@ -16,14 +16,13 @@ git https://stackify.com/wp-content/uploads/2017/02/stk.png StackifyLib.CoreLogger - 2.1.0 + 2.1.1 - diff --git a/Src/StackifyLib.CoreLogger/StackifyLogger.cs b/Src/StackifyLib.CoreLogger/StackifyLogger.cs index efa697f..e760459 100644 --- a/Src/StackifyLib.CoreLogger/StackifyLogger.cs +++ b/Src/StackifyLib.CoreLogger/StackifyLogger.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; using StackifyLib.Models; @@ -19,16 +16,20 @@ public bool IsEnabled(LogLevel logLevel) return true; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, - Func formatter) + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) { if (formatter == null) + { throw new ArgumentNullException("formatter"); - string message = formatter(state, exception); + } + + var message = formatter(state, exception); if (string.IsNullOrEmpty(message)) + { return; + } - var msg = new LogMsg() + var msg = new LogMsg { Level = logLevel.ToString(), Msg = message @@ -45,8 +46,8 @@ public void Close() } catch (Exception) { - + // ignored } } } -} +} \ No newline at end of file diff --git a/Src/StackifyLib.CoreLogger/StackifyLoggerProvider.cs b/Src/StackifyLib.CoreLogger/StackifyLoggerProvider.cs index 4e814e3..f9c4ded 100644 --- a/Src/StackifyLib.CoreLogger/StackifyLoggerProvider.cs +++ b/Src/StackifyLib.CoreLogger/StackifyLoggerProvider.cs @@ -1,28 +1,25 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; namespace StackifyLib.CoreLogger { - public class StackifyLoggerProvider : ILoggerProvider, IDisposable + public class StackifyLoggerProvider : ILoggerProvider { - private StackifyLogger _StackifyLogger = null; + private StackifyLogger _stackifyLogger; public Microsoft.Extensions.Logging.ILogger CreateLogger(string name) { - if (_StackifyLogger == null) + if (_stackifyLogger == null) { - _StackifyLogger = new StackifyLogger(); + _stackifyLogger = new StackifyLogger(); } - return _StackifyLogger; + return _stackifyLogger; } public void Dispose() { - _StackifyLogger?.Close(); + _stackifyLogger?.Close(); } } -} +} \ No newline at end of file diff --git a/Src/StackifyLib/Config.cs b/Src/StackifyLib/Config.cs index 37817ec..2874864 100644 --- a/Src/StackifyLib/Config.cs +++ b/Src/StackifyLib/Config.cs @@ -1,80 +1,85 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Diagnostics; using StackifyLib.Utils; namespace StackifyLib { - /// - /// Encapsulate settings retrieval mechanism. Currently supports config file and environment variables. - /// Could be expanded to include other type of configuration servers later. - /// - public class Config - { -#if NETCORE + /// + /// Encapsulate settings retrieval mechanism. Currently supports config file and environment variables. + /// Could be expanded to include other type of configuration servers later. + /// + public class Config + { + #if NETCORE || NETCOREX + private static Microsoft.Extensions.Configuration.IConfigurationRoot _configuration = null; - public static void SetConfiguration(Microsoft.Extensions.Configuration.IConfigurationRoot configuration) - { - _configuration = configuration; - } -#endif + public static void SetConfiguration(Microsoft.Extensions.Configuration.IConfigurationRoot configuration) + { + _configuration = configuration; + } + + #endif + + static Config() + { + LoadSettings(); + } public static void LoadSettings() - { - try - { - CaptureErrorPostdata = Get("Stackify.CaptureErrorPostdata", "").Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); + { + try + { + CaptureErrorPostdata = Get("Stackify.CaptureErrorPostdata", string.Empty).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); - CaptureServerVariables = Get("Stackify.CaptureServerVariables", "").Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); + CaptureServerVariables = Get("Stackify.CaptureServerVariables", string.Empty).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); - CaptureSessionVariables = Get("Stackify.CaptureSessionVariables", "").Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); + CaptureSessionVariables = Get("Stackify.CaptureSessionVariables", string.Empty).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); CaptureErrorHeaders = Get("Stackify.CaptureErrorHeaders", bool.TrueString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); - CaptureErrorCookies = Get("Stackify.CaptureErrorCookies", "").Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); + CaptureErrorCookies = Get("Stackify.CaptureErrorCookies", string.Empty).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); - ApiKey = Get("Stackify.ApiKey", ""); + ApiKey = Get("Stackify.ApiKey", string.Empty); - AppName = Get("Stackify.AppName", ""); + AppName = Get("Stackify.AppName", string.Empty); - Environment = Get("Stackify.Environment", ""); + Environment = Get("Stackify.Environment", string.Empty); - CaptureErrorHeadersWhitelist = Get("Stackify.CaptureErrorHeadersWhitelist", ""); + CaptureErrorHeadersWhitelist = Get("Stackify.CaptureErrorHeadersWhitelist", string.Empty); - if (string.IsNullOrEmpty(CaptureErrorHeadersWhitelist) == false) - { - ErrorHeaderGoodKeys = CaptureErrorHeadersWhitelist.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); - } + if (string.IsNullOrEmpty(CaptureErrorHeadersWhitelist) == false) + { + ErrorHeaderGoodKeys = CaptureErrorHeadersWhitelist.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); + } - CaptureErrorHeadersBlacklist = Get("Stackify.CaptureErrorHeadersBlacklist", ""); + CaptureErrorHeadersBlacklist = Get("Stackify.CaptureErrorHeadersBlacklist", string.Empty); if (string.IsNullOrEmpty(CaptureErrorHeadersBlacklist) == false) { ErrorHeaderBadKeys = CaptureErrorHeadersBlacklist.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); } - CaptureErrorCookiesWhitelist = Get("Stackify.CaptureErrorCookiesWhitelist", ""); + CaptureErrorCookiesWhitelist = Get("Stackify.CaptureErrorCookiesWhitelist", string.Empty); if (string.IsNullOrEmpty(CaptureErrorCookiesWhitelist) == false) { ErrorCookiesGoodKeys = CaptureErrorCookiesWhitelist.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); } - CaptureErrorCookiesBlacklist = Get("Stackify.CaptureErrorCookiesBlacklist", ""); + CaptureErrorCookiesBlacklist = Get("Stackify.CaptureErrorCookiesBlacklist", string.Empty); if (string.IsNullOrEmpty(CaptureErrorCookiesBlacklist) == false) { ErrorCookiesBadKeys = CaptureErrorCookiesBlacklist.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); } - CaptureErrorSessionWhitelist = Get("Stackify.CaptureErrorSessionWhitelist", ""); + CaptureErrorSessionWhitelist = Get("Stackify.CaptureErrorSessionWhitelist", string.Empty); if (string.IsNullOrEmpty(CaptureErrorSessionWhitelist) == false) { ErrorSessionGoodKeys = CaptureErrorSessionWhitelist.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); } // SF-6804: Frequent Calls to GetEC2InstanceId - var captureEc2InstanceMetadataUpdateThresholdMinutes = Get("Stackify.Ec2InstanceMetadataUpdateThresholdMinutes", ""); + var captureEc2InstanceMetadataUpdateThresholdMinutes = Get("Stackify.Ec2InstanceMetadataUpdateThresholdMinutes", string.Empty); if (string.IsNullOrWhiteSpace(captureEc2InstanceMetadataUpdateThresholdMinutes) == false) { if (int.TryParse(captureEc2InstanceMetadataUpdateThresholdMinutes, out int minutes) && minutes != 0) @@ -84,23 +89,23 @@ public static void LoadSettings() } // SF-6204: Allow local overrides of EC2 detection - var isEc2 = Get("Stackify.IsEC2", ""); + var isEc2 = Get("Stackify.IsEC2", string.Empty); if (string.IsNullOrWhiteSpace(isEc2) == false) { IsEc2 = isEc2.Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); } // RT-297 - var apiLog = Get("Stackify.ApiLog", ""); - if (string.IsNullOrWhiteSpace(apiLog) == false) - { - ApiLog = apiLog.Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); - } - } + var apiLog = Get("Stackify.ApiLog", string.Empty); + if (string.IsNullOrWhiteSpace(apiLog) == false) + { + ApiLog = apiLog.Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase); + } + } catch (Exception ex) - { - StackifyAPILogger.Log("#Config #LoadSettings failed", ex); - } + { + StackifyAPILogger.Log("#Config #LoadSettings failed", ex); + } } public static string ApiKey { get; set; } @@ -114,27 +119,27 @@ public static void LoadSettings() public static List ErrorCookiesBadKeys = new List(); public static List ErrorSessionGoodKeys = new List(); - public static bool CaptureSessionVariables { get; set; } = false; - public static bool CaptureServerVariables { get; set; } = false; - public static bool CaptureErrorPostdata { get; set; } = false; + public static bool CaptureSessionVariables { get; set; } + public static bool CaptureServerVariables { get; set; } + public static bool CaptureErrorPostdata { get; set; } public static bool CaptureErrorHeaders { get; set; } = true; - public static bool CaptureErrorCookies { get; set; } = false; + public static bool CaptureErrorCookies { get; set; } - public static string CaptureErrorSessionWhitelist { get; set; } = null; + public static string CaptureErrorSessionWhitelist { get; set; } - public static string CaptureErrorHeadersWhitelist { get; set; } = null; + public static string CaptureErrorHeadersWhitelist { get; set; } public static string CaptureErrorHeadersBlacklist { get; set; } = "cookie,authorization"; - public static string CaptureErrorCookiesWhitelist { get; set; } = null; + public static string CaptureErrorCookiesWhitelist { get; set; } public static string CaptureErrorCookiesBlacklist { get; set; } = ".ASPXAUTH"; public static int Ec2InstanceMetadataUpdateThresholdMinutes { get; set; } = 60; - public static bool? IsEc2 { get; set; } = null; + public static bool? IsEc2 { get; set; } - public static bool? ApiLog { get; set; } = null; + public static bool? ApiLog { get; set; } /// /// Attempts to fetch a setting value given the key. @@ -144,14 +149,22 @@ public static void LoadSettings() /// If nothing is found, return optional defaultValue provided. /// string value for the requested setting key. internal static string Get(string key, string defaultValue = null) - { - string v = null; - - try - { - if (key != null) - { -#if NETCORE + { + string v = null; + + try + { + if (key != null) + { +#if NETCORE || NETCOREX + if (_configuration != null) + { + var appSettings = _configuration.GetSection("Stackify"); + v = appSettings[key.Replace("Stackify.", "")]; + } +#endif + +#if NETCOREX if (_configuration != null) { var appSettings = _configuration.GetSection("Stackify"); @@ -166,21 +179,21 @@ internal static string Get(string key, string defaultValue = null) } #endif - if (string.IsNullOrEmpty(v)) - { - v = System.Environment.GetEnvironmentVariable(key); - } + if (string.IsNullOrEmpty(v)) + { + v = System.Environment.GetEnvironmentVariable(key); + } } } - finally - { - if (v == null) - { - v = defaultValue; - } - } - - return v; - } - } + finally + { + if (v == null) + { + v = defaultValue; + } + } + + return v; + } + } } \ No newline at end of file diff --git a/Src/StackifyLib/Extensions.cs b/Src/StackifyLib/Extensions.cs index 277fe4d..d1e127d 100644 --- a/Src/StackifyLib/Extensions.cs +++ b/Src/StackifyLib/Extensions.cs @@ -1,11 +1,4 @@ using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using StackifyLib.Utils; namespace StackifyLib @@ -38,7 +31,7 @@ public static StackifyLib.StackifyError NewStackifyError(this Exception ex) } } -#if NETCORE +#if NETCORE || NETCOREX public static void ConfigureStackifyLogging(this Microsoft.Extensions.Configuration.IConfigurationRoot configuration) { Config.SetConfiguration(configuration); @@ -47,4 +40,4 @@ public static void ConfigureStackifyLogging(this Microsoft.Extensions.Configurat } #endif } -} +} \ No newline at end of file diff --git a/Src/StackifyLib/StackifyLib.csproj b/Src/StackifyLib/StackifyLib.csproj index bd973d3..4329a42 100644 --- a/Src/StackifyLib/StackifyLib.csproj +++ b/Src/StackifyLib/StackifyLib.csproj @@ -2,8 +2,8 @@ Stackify API - 2.0.0 - netstandard2.0;net40;net45;net451;net452;net46 + 2.1.0 + netstandard2.0;net40;net45;net451;net452;net46;net461;net462 StackifyLib StackifyLib stackify;metrics;errors;logs @@ -13,30 +13,26 @@ false false false - 2.1.0 + 2.1.1 StackifyLib https://github.com/stackify/stackify-api-dotnet https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE https://github.com/stackify/stackify-api-dotnet git https://stackify.com/wp-content/uploads/2017/02/stk.png - 2.1.0.0 - 2.1.0.0 + 2.1.1.0 + 2.1.1.0 - - + - - - - NETCORE - + + + - - + @@ -44,9 +40,17 @@ - + - + + + NETCORE + + + + NETCORE;NETCOREX;NETFULL + + NETFULL diff --git a/Src/StackifyLibCore.sln b/Src/StackifyLibCore.sln index 66ddac5..ec854ee 100644 --- a/Src/StackifyLibCore.sln +++ b/Src/StackifyLibCore.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.4 +VisualStudioVersion = 15.0.27130.2024 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackifyLib", "StackifyLib\StackifyLib.csproj", "{03CF7411-65E2-4998-A157-9224ECA6199B}" EndProject @@ -73,4 +73,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6AB55A24-BCFF-4641-90E0-7921CAD32F49} + EndGlobalSection EndGlobal