コード例 #1
0
ファイル: Loger.cs プロジェクト: JillyMan/DOT_NET
        public static void Log(string info, Type type = null, Exception e = null)
        {
            lock (syncObj)
            {
                if (!System.IO.File.Exists(path))
                {
                    System.IO.File.Create(path).Dispose();
                }

                using (var sw = new System.IO.StreamWriter(path, true))
                {
                    string stringToWrite = info + "\n";

                    if (type != null)
                    {
                        stringToWrite += type.FullName;
                    }
                    if (e != null)
                    {
                        stringToWrite += e.ToString();
                    }
                    sw.WriteLine(stringToWrite);
                    if (OtherLog != null)
                    {
                        OtherLog.Invoke(stringToWrite);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Logger.cs プロジェクト: magenran/Bot-Application1
 public static void addLog(string v)
 {
     try
     {
         var log = new OtherLog();
         log.time = DateTime.UtcNow;
         log.data = v;
         new DataBaseController().addOtherLog(log);
     }
     catch (Exception ex)
     {
     }
 }