Skip to content

Commit 52c3c7d

Browse files
committed
Change Config.Get logs from Trace to Debug level to reduce noise
1 parent 914d081 commit 52c3c7d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Configuration/Config.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static string Get(string key, string defaultValue = "")
146146
var token = GetToken(Settings.Value, key);
147147
if (token == null)
148148
{
149-
Log.Trace(Invariant($"Config.Get(): Configuration key not found. Key: {key} - Using default value: {defaultValue}"));
149+
Log.Debug(Invariant($"Config.Get(): Configuration key not found. Key: {key} - Using default value: {defaultValue}"));
150150
return defaultValue;
151151
}
152152
return token.ToString();
@@ -227,18 +227,18 @@ public static double GetDouble(string key, double defaultValue = 0.0)
227227
public static T GetValue<T>(string key, T defaultValue = default(T))
228228
{
229229
// special case environment requests
230-
if (key == "environment" && typeof (T) == typeof (string)) return (T) (object) GetEnvironment();
230+
if (key == "environment" && typeof(T) == typeof(string)) return (T)(object)GetEnvironment();
231231

232232
var token = GetToken(Settings.Value, key);
233233
if (token == null)
234234
{
235235
var defaultValueString = defaultValue is IConvertible
236-
? ((IConvertible) defaultValue).ToString(CultureInfo.InvariantCulture)
236+
? ((IConvertible)defaultValue).ToString(CultureInfo.InvariantCulture)
237237
: defaultValue is IFormattable
238-
? ((IFormattable) defaultValue).ToString(null, CultureInfo.InvariantCulture)
238+
? ((IFormattable)defaultValue).ToString(null, CultureInfo.InvariantCulture)
239239
: Invariant($"{defaultValue}");
240240

241-
Log.Trace(Invariant($"Config.GetValue(): {key} - Using default value: {defaultValueString}"));
241+
Log.Debug(Invariant($"Config.GetValue(): {key} - Using default value: {defaultValueString}"));
242242
return defaultValue;
243243
}
244244

@@ -255,22 +255,22 @@ public static double GetDouble(string key, double defaultValue = 0.0)
255255

256256
if (type.IsEnum)
257257
{
258-
return (T) Enum.Parse(type, value, true);
258+
return (T)Enum.Parse(type, value, true);
259259
}
260260

261261
if (typeof(IConvertible).IsAssignableFrom(type))
262262
{
263-
return (T) Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
263+
return (T)Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
264264
}
265265

266266
// try and find a static parse method
267267
try
268268
{
269-
var parse = type.GetMethod("Parse", new[]{typeof(string)});
269+
var parse = type.GetMethod("Parse", new[] { typeof(string) });
270270
if (parse != null)
271271
{
272-
var result = parse.Invoke(null, new object[] {value});
273-
return (T) result;
272+
var result = parse.Invoke(null, new object[] { value });
273+
return (T)result;
274274
}
275275
}
276276
catch (Exception err)
@@ -381,7 +381,7 @@ public static JObject Flatten(JObject config, string overrideEnvironment)
381381
var environments = config["environments"];
382382
if (!(environments is JObject)) continue;
383383

384-
var settings = ((JObject) environments).SelectToken(env);
384+
var settings = ((JObject)environments).SelectToken(env);
385385
if (settings == null) continue;
386386

387387
// copy values for the selected environment to the root
@@ -395,7 +395,7 @@ public static JObject Flatten(JObject config, string overrideEnvironment)
395395
var jProperty = clone.Property(path);
396396
if (jProperty != null) jProperty.Remove();
397397

398-
var value = (token is JProperty ? ((JProperty) token).Value : token).ToString();
398+
var value = (token is JProperty ? ((JProperty)token).Value : token).ToString();
399399
clone.Add(path, value);
400400
}
401401
}

0 commit comments

Comments
 (0)