ソースを参照

添加记录文本日志方法

长阳分支中职
北京泉江 10ヶ月前
committed by dao
コミット
05c67f3c6e
2個のファイルの変更35行の追加0行の削除
  1. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj
  2. +33
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs

+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj ファイルの表示

@@ -95,6 +95,7 @@
<Compile Include="DataBase\FieldTypeHepler.cs" />
<Compile Include="DataBase\FieldValueParam.cs" />
<Compile Include="DataBase\DbWhere.cs" />
<Compile Include="Log\LogHelper.cs" />
<Compile Include="Mail\Model\MailAccount .cs" />
<Compile Include="Mail\Model\MailFile.cs" />
<Compile Include="Mail\Model\MailModel.cs" />
@@ -154,6 +155,7 @@
<Analyzer Include="..\..\..\packages\Microsoft.DependencyValidation.Analyzers.0.10.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" />
<Analyzer Include="..\..\..\packages\Microsoft.DependencyValidation.Analyzers.0.10.0\analyzers\dotnet\Microsoft.DependencyValidation.Analyzers.dll" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">


+ 33
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs ファイルの表示

@@ -0,0 +1,33 @@
using System;
using System.IO;

namespace Learun.Util.Log
{
public class LogHelper
{
public static void Info(string msg)
{
try
{
#region log
//文件路径
string path = Path.Combine(Directory.GetCurrentDirectory(), "logs");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

//文件
string fileName = Path.Combine(path, $"{DateTime.Now:yyyyMMdd}.log");
string message = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} logInfo:{msg}。{Environment.NewLine}";
File.AppendAllText(fileName, message);
#endregion
}
catch
{


}
}
}
}

読み込み中…
キャンセル
保存