#pragma warning restore CA1822 private void WriteLine(DiagnosticLogLevel level, string content) { if (level >= _minimumLevel) { Console.WriteLine($"[{level}] {content}"); } }
private void Write(DiagnosticLogLevel level, string message, params object[] args) { if (_innerSource.IsEnabled(level.ToString())) { _innerSource.Write(level.ToString(), new { content = string.Format(CultureInfo.InvariantCulture, message, args), }); } }
private void Write(DiagnosticLogLevel level, string message, params object[] args) { if (_innerSource.IsEnabled(level.ToString())) { string timedFormat = "[" + DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture) + "] " + message; _innerSource.Write(level.ToString(), new { content = string.Format(CultureInfo.InvariantCulture, timedFormat, args), }); } }
/// <summary> /// Create an instance of an application insights kubernetes diagnostic source observer for diagnostic logs. /// </summary> /// <param name="minimumLevel"></param> public ApplicationInsightsKubernetesDiagnosticObserver(DiagnosticLogLevel?minimumLevel) { _minimumLevel = minimumLevel ?? DiagnosticLogLevel.Warning; }
public int GetCount(DiagnosticLogLevel level) { return(Output.Where(o => o.Item1 == level).Count()); }