Ejemplo n.º 1
0
 public void Error(string format)
 {
     ErrorEntries.Add(new LogEntry
     {
         Format = format,
     });
 }
Ejemplo n.º 2
0
 public void Error(string format, params object[] args)
 {
     ErrorEntries.Add(new LogEntry
     {
         Format = format,
         Params = args,
     });
 }
Ejemplo n.º 3
0
 public void Error(Exception exception, string format, params object[] args)
 {
     ErrorEntries.Add(new LogEntry
     {
         Format    = format,
         Params    = args,
         Exception = exception
     });
 }
Ejemplo n.º 4
0
    public void Error(string message, string location = null, Exception exception = null)
    {
        LogEntry logEvent = new LogEntry
        {
            ID        = 0,
            Message   = message,
            TimeStamp = DateTime.UtcNow,
            Type      = Enums.LogLevel.DEBUG,
            UserName  = "******",
            Location  = location
        };

        var eventname = Environment.StackTrace.Split('\n').Select(o => o.Substring(0, o.Length - 3)).Where(o => EventByFrame.Keys.Any(k => o.Equals(k)));

        if (eventname.Any())
        {
            logEvent.Event      = EventByFrame.Where(o => eventname.Contains(o.Key)).Select(o => o.Value).FirstOrDefault();
            logEvent.EventTrace = string.Join(",", EventByFrame.Where(o => eventname.Contains(o.Key)).Select(o => o.Value).ToArray());
        }

        ErrorEntries.Add(logEvent);
    }