zhangyuekai
2024-07-09 3af5133a727cc88ed9b83f2967ed0bdf8c51427f
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
using HStation.RevitDev.RevitRelationMap.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HStation.RevitDev.RevitRelationMap.Common
{
    public class Log : Singleton<Log>
    {
        private string LogPath = string.Empty;
        public void SetLogPath(string path)
        {
            LogPath = path;
        }
        public void WriteError(string message)
        {
            DateTime now = DateTime.Now;
            var prefix = $@"{now.ToString("yy-MM-dd HH:mm:ss.fff")} Error:";
            File.AppendAllText(LogPath, prefix + message + "\n");
        }
        public void WriteInfo(string message)
        {
            DateTime now = DateTime.Now;
            var prefix = $@"{now.ToString("yy-MM-dd HH:mm:ss.fff")} Info:";
            File.AppendAllText(LogPath, prefix + message + "\n");
        }
    }
}