Browse Source

添加记录文本日志方法

长阳分支中职
北京泉江 10 months ago
committed by dao
parent
commit
05c67f3c6e
2 changed files with 35 additions and 0 deletions
  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 View File

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


+ 33
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs View File

@@ -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
{


}
}
}
}

Loading…
Cancel
Save