Skip to content
Snippets Groups Projects
Commit c934320f authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Product/574-configDefault' into 'Sprint/2020-05'

Product/574-configDefault

See merge request coscine/cs/logging!9
parents 49b9b60b 96f395bf
No related branches found
No related tags found
2 merge requests!9Product/574-configDefault,!7Sprint/2020-05
......@@ -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)
{
return Encoding.UTF8.GetString(returnValue, 0, returnValue.Length);
var value = getPair.Result.Response.Value;
return Encoding.UTF8.GetString(value, 0, value.Length);
}
else
{
// TODO: Add logging that key has not been found
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;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment