Skip to content
Snippets Groups Projects

Product/574-configDefault

Merged Marcel Nellesen requested to merge Product/574-configDefault into Sprint/2020-05
1 file
+ 25
12
Compare changes
  • Side-by-side
  • Inline
+ 25
12
@@ -350,13 +350,13 @@ namespace Coscine.Logging
private static void UpdateActiveLogs()
{
activeLoglevels[(int)LogType.Debug] = !GetStringFromConsul(LogLevelKeyDebug).Equals("0");
activeLoglevels[(int)LogType.Low] = !GetStringFromConsul(LogLevelKeyLow).Equals("0");
activeLoglevels[(int)LogType.Medium] = !GetStringFromConsul(LogLevelKeyMedium).Equals("0");
activeLoglevels[(int)LogType.High] = !GetStringFromConsul(LogLevelKeyHigh).Equals("0");
activeLoglevels[(int)LogType.Critical] = !GetStringFromConsul(LogLevelKeyCritical).Equals("0");
activeLoglevels[(int)LogType.Analytics] = !GetStringFromConsul(LogLevelKeyAnalytics).Equals("0");
activeLoglevels[(int)LogType.Reporting] = !GetStringFromConsul(LogLevelKeyReporting).Equals("0");
activeLoglevels[(int)LogType.Debug] = !GetStringFromConsul(LogLevelKeyDebug, "0").Equals("0");
activeLoglevels[(int)LogType.Low] = !GetStringFromConsul(LogLevelKeyLow, "0").Equals("0");
activeLoglevels[(int)LogType.Medium] = !GetStringFromConsul(LogLevelKeyMedium, "0").Equals("0");
activeLoglevels[(int)LogType.High] = !GetStringFromConsul(LogLevelKeyHigh, "1").Equals("0");
activeLoglevels[(int)LogType.Critical] = !GetStringFromConsul(LogLevelKeyCritical, "1").Equals("0");
activeLoglevels[(int)LogType.Analytics] = !GetStringFromConsul(LogLevelKeyAnalytics, "0").Equals("0");
activeLoglevels[(int)LogType.Reporting] = !GetStringFromConsul(LogLevelKeyReporting, "0").Equals("0");
var config = LogManager.Configuration;
config.FindRuleByName("blockAllInformation").Final = !activeLoglevels[(int)LogType.Analytics] && !activeLoglevels[(int)LogType.Reporting];
@@ -392,15 +392,28 @@ namespace Coscine.Logging
getPair.Wait();
var returnValue = getPair.Result.Response.Value;
if (returnValue != null)
if (getPair.Result.Response?.Value != null)
{
var value = getPair.Result.Response.Value;
return Encoding.UTF8.GetString(value, 0, value.Length);
}
else
{
return Encoding.UTF8.GetString(returnValue, 0, returnValue.Length);
// TODO: Add logging that key has not been found
return null;
}
return null;
}
}
private static string GetStringFromConsul(string key, string defaultValue)
{
var value = GetStringFromConsul(key);
if(value == null)
{
// TODO: Add logging that default value has been used
return defaultValue;
}
return value;
}
}
}
Loading