Exemplo n.º 1
0
        public ATTLog GetLog(string Message, LogType tp)
        {
            ATTLog l = new ATTLog();

            l.LogDt       = DateTime.Now;
            l.LogTp       = tp;
            l.FileName    = Path.Combine(TaskFolder, $"{TaskId}.txt");
            l.TaskId      = TaskId;
            l.Description = Message;
            return(l);
        }
Exemplo n.º 2
0
        public static void Write(ATTLog logItem)
        {
            string msg = $"{logItem.LogDt.ToString("yyyy.MM.dd HH:mm:ss")}--[{logItem.LogTp.ToString()}]--[{logItem.TaskId}]--{logItem.Description}";

            using (var fs = new FileStream(logItem.FileName, FileMode.Append)) {
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine(msg);
                sw.Close();
            }
            OnLog?.Invoke(logItem);
        }