37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
namespace IronIntel.Contractor
|
|
{
|
|
static class Log
|
|
{
|
|
public static void WriteMessage(string msg)
|
|
{
|
|
try
|
|
{
|
|
string dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log");
|
|
if(!Directory.Exists(dir))
|
|
{
|
|
Directory.CreateDirectory(dir);
|
|
}
|
|
string fn = Path.Combine(dir, "svclog.txt");
|
|
using (FileStream fs = new FileStream(fn, FileMode.Append, FileAccess.Write))
|
|
{
|
|
using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
|
|
{
|
|
sw.Write(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
|
sw.Write(": ");
|
|
sw.WriteLine(msg);
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
}
|