Beispiel #1
0
        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);
                    }
                }
            }
        }
Beispiel #2
0
 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)
     {
     }
 }