Beispiel #1
0
 private void GuardarLogException(DadosLogException newException)
 {
     try {
         using (StreamWriter Salvar = File.AppendText(fileLogException)) {
             Salvar.WriteLine("Exceptions inesperada: ");
             Salvar.Write("Classe: ");
             Salvar.WriteLine(newException.classe);
             Salvar.Write("Método: ");
             Salvar.WriteLine(newException.metodo);
             Salvar.Write("Instante: ");
             Salvar.WriteLine(newException.data);
             Salvar.Write("Nota do usuário: ");
             Salvar.WriteLine(newException.nota);
             if (newException.notaAdm.Length > 0)
             {
                 Salvar.WriteLine(newException.notaAdm);
             }
             Salvar.Write("Mensagem:");
             Salvar.WriteLine(newException.mensagem);
             Salvar.Write("\n\n");
         }
     }
     catch (Exception e) {
         LogisticaException.ExceptionGrave("LE_Save_Exception", e, "Save", "GuardarLogException");
     } //IO Exception
 }
Beispiel #2
0
        //  PREPARO E EXPORTAÇÃO DO LOG DE ERRO PARA A CLASSE SAVE
        private static void RegistrarLogException(string te, Exception ms = null, string cl = "null", string me = "null", bool infNota = false, string infNoteAdm = "null")
        {
            DadosLogException newException = new DadosLogException(); //  Tipo modelo para logs de erro

            newException.tipo     = te;
            newException.classe   = cl;
            newException.metodo   = me;
            newException.data     = DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss");
            newException.mensagem = ms;
            newException.notaAdm  = infNoteAdm;
            if (infNota)
            {
                Console.Write("\nNos informe um pouco sobre o ocorrido, ou clique na tecla ENTER para continuar:\n>> ");
                newException.nota = Console.ReadLine();
            }
            else
            {
                newException.nota = "null";
            }

            file.setLogException(newException); //  Exportar para a classe save
        }
Beispiel #3
0
 public void setLogException(DadosLogException e)
 {
     System.Threading.Thread.Sleep(5);
     GuardarLogException(e);
 }