1
This commit is contained in:
44
Pilot.Report.Exploitation/Common/Loghelp.cs
Normal file
44
Pilot.Report.Exploitation/Common/Loghelp.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Pilot.Report.Exploitation.Common
|
||||
{
|
||||
public static class Loghelp
|
||||
{
|
||||
|
||||
|
||||
public static void Log(string str)
|
||||
{
|
||||
//return;
|
||||
str = DateTime.Now + "----\n" + str;
|
||||
string now = DateTime.Now.Date.ToString("yyyy-MM-dd");
|
||||
string currentDirectory = Environment.CurrentDirectory;
|
||||
string path = @"D:/RequestLog/";
|
||||
string fileName = now + "Log.txt";
|
||||
string sourceFilePath = path + fileName;
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(sourceFilePath))
|
||||
{
|
||||
|
||||
if (!System.IO.File.Exists(sourceFilePath))
|
||||
{
|
||||
FileInfo fileinfo = new FileInfo(sourceFilePath);
|
||||
fileinfo.Create();
|
||||
}
|
||||
sw.WriteLine(str);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user