File size: 872 Bytes
e26fba6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace MovieTube.Viewer
{
    public static class LogManager
    {
        private static string ErrorFile = "error.txt";
        private static string LogFile = "log.txt";

        static LogManager()
        {

        }

        public static  void Log(string message)
        {
            if(AppSettings.Log)
                File.AppendAllText(LogFile,  DateTime.Now.ToString() + ": " + message  +Environment.NewLine);
            
        }

        public static void LogError(string message, Exception ex)
        {
            if (AppSettings.Log)
                File.AppendAllText(ErrorFile, DateTime.Now.ToString() + ": " + message + ": Exception => " + ex != null ? ex.ToString() : String.Empty + Environment.NewLine);
        }
    }
}