Exemplo n.º 1
0
        public static Dictionary <string, string> ToDictionary(this ILoggerProperties properties)
        {
            if (properties == null)
            {
                return(null);
            }

            var newDict = new Dictionary <string, string>();
            var typen   = properties.GetType();

            foreach (var propInfo in typen.GetProperties())
            {
                var propValue       = propInfo.GetValue(properties, null);
                var dictionaryValue = propValue?.ToString() ?? null;

                newDict.Add(propInfo.Name, dictionaryValue);
            }

            return(newDict);
        }
Exemplo n.º 2
0
 public void Debug(string text, ILoggerProperties properties = null)
 {
     Console.Out.WriteLine(text);
 }
Exemplo n.º 3
0
 public void CustomEvent(string text, ILoggerProperties properties = null)
 {
     Console.Out.WriteLine(text);
 }
Exemplo n.º 4
0
 public void Fatal(string text, Exception ex, ILoggerProperties properties = null)
 {
     Console.Error.WriteLine($"{text}\n{ex}");
 }
Exemplo n.º 5
0
 public void Fatal(string text, ILoggerProperties properties = null)
 {
     Console.Error.WriteLine(text);
 }
Exemplo n.º 6
0
 public void Warn(string text, Exception ex, ILoggerProperties properties = null)
 {
     Console.Out.WriteLine($"{text}\n{ex}");
 }
Exemplo n.º 7
0
 public void CustomEvent(string text, ILoggerProperties properties = null)
 {
     _telemetryClient.TrackEvent(text, properties.ToDictionary());
     _telemetryClient.Flush();
 }
Exemplo n.º 8
0
 public void Fatal(string text, Exception ex, ILoggerProperties properties = null)
 {
     _telemetryClient.TrackTrace($"{text}\n{ex}", SeverityLevel.Critical, properties.ToDictionary());
     _telemetryClient.TrackException(ex, properties.ToDictionary());
     _telemetryClient.Flush();
 }
Exemplo n.º 9
0
 public void Fatal(string text, ILoggerProperties properties = null)
 {
     _telemetryClient.TrackTrace(text, SeverityLevel.Critical, properties.ToDictionary());
     _telemetryClient.Flush();
 }
Exemplo n.º 10
0
 public void Info(string text, ILoggerProperties properties = null)
 {
     _telemetryClient.TrackTrace(text, SeverityLevel.Information, properties.ToDictionary());
     _telemetryClient.Flush();
 }
Exemplo n.º 11
0
 public void Debug(string text, ILoggerProperties properties = null)
 {
     _telemetryClient.TrackTrace(text, SeverityLevel.Verbose, properties.ToDictionary());
 }
Exemplo n.º 12
0
 public void Fatal(string text, Exception ex, ILoggerProperties properties = null)
 {
     _loggers.ForEach(p => p.Fatal(text, ex, properties));
 }
Exemplo n.º 13
0
 public void Error(string text, ILoggerProperties properties = null)
 {
     _loggers.ForEach(p => p.Error(text, properties));
 }
Exemplo n.º 14
0
 public void Warn(string text, ILoggerProperties properties = null)
 {
     _loggers.ForEach(p => p.Warn(text, properties));
 }
Exemplo n.º 15
0
 public void Debug(string text, ILoggerProperties properties = null)
 {
     _loggers.ForEach(p => p.Debug(text, properties));
 }
Exemplo n.º 16
0
 public void Info(string text, ILoggerProperties properties = null)
 {
     _loggers.ForEach(p => p.Info(text, properties));
 }