Exemplo n.º 1
0
 public static void Print(string msg, Exception ex = null)
 {
     if (OnMessage == null)
         return;
     var ev = new LogEvent { Mensaje = msg, Error = ex };
     OnMessage(ev);
 }
Exemplo n.º 2
0
 protected void Print(string msg, Exception error = null)
 {
     if (string.IsNullOrEmpty(msg) || Mensaje == null)
         return;
     var log = new LogEvent(msg, this);
     log.Error = error;
     Mensaje(log);
 }
Exemplo n.º 3
0
 public void Print(string message, Exception error = null)
 {
     if (OnMessage == null)
         return;
     if (string.IsNullOrEmpty(message))
         return;
     var msg = new LogEvent(message.Trim(), this, "Script") { Error = error };
     OnMessage(msg);
 }
Exemplo n.º 4
0
 public void PushMessage(LogEvent e)
 {
     if (!string.IsNullOrEmpty(e.Mensaje)) {
         var nl = (e.Mensaje.EndsWith(Environment.NewLine) || e.Mensaje.EndsWith("\r\n"))
                     ? ""
                     : Environment.NewLine;
         var msg = string.Format("{0}{1}", e.Mensaje.Trim(), nl);
         txtLog.AppendText(msg);
     }
     if (e.Error != null) {
         //var sb = new StringBuilder(e.Mensaje).AppendLine(e.Error.StackTrace);
         var sb = new StringBuilder(e.Mensaje).AppendLine(e.Error.ToString());
         if (e.Error.InnerException != null) {
             sb.AppendLine("-- inner exception")
                 .AppendLine(e.Error.InnerException.Message)
                 .AppendLine(e.Error.InnerException.StackTrace);
         }
         txtErrores.Text = sb.ToString();
     }
     // mejor un listview?
 }
Exemplo n.º 5
0
 public void LogMessageEvent(LogEvent e)
 {
     if (InvokeRequired) {
         Invoke(new MethodInvoker(() => PushMessage(e)));
     } else {
         PushMessage(e);
     }
 }
Exemplo n.º 6
0
 public void LogMessage(string msg, Exception error = null)
 {
     var ev = new LogEvent(msg, this) { Error = error };
     LogMessageEvent(ev);
 }