qin
2024-09-28 e358beb08f5be49703009b64f058ecfbcfeefbd9
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.RevitDataExport.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HStation.RevitDev.RevitDataExport.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");
        }
    }
}