Esempio n. 1
0
        public static void TryLog(this ErrorLog error)
        {
            var textError = error.ToString();

            try
            {
                var path = Cfg.LogErrorsFile(error.ID);

                if (!Directory.Exists(Cfg.LogErrorsPath))
                {
                    Directory.CreateDirectory(Cfg.LogErrorsPath);
                }

                File.WriteAllText(path, textError);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error while recording log: {e}");
            }
            finally
            {
                Console.WriteLine($"Error that happened: {textError.Replace("\\n", "\n")}");
            }
        }