コード例 #1
0
        internal void InserirLogJson(LogVO log)
        {
            var error = new Dictionary <string, object>
            {
                { "DataErro", log.DataHora.ToString("yyyy/MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture) },
                { "Exception", ExceptionParaDictionary(log.Exception) }
            };

            string logJson = JsonConvert.SerializeObject(error);

            GravarArquivo(logJson);
        }
コード例 #2
0
        public static void Gravar(Exception ex)
        {
            try
            {
                LogVO log = new LogVO(ex);

                LogDao logDao = new LogDao();
                logDao.InserirLogJson(log);
            }
            catch (Exception bigException)
            {
                Console.WriteLine($"Erro ao gravar log: {bigException.Message}");
            }
        }