From 05c67f3c6ef7d1281739a520b68b9cb36dac819a Mon Sep 17 00:00:00 2001 From: zzj <31836194@qq.com> Date: Tue, 9 Jan 2024 09:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=B0=E5=BD=95=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=97=A5=E5=BF=97=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Util/Learun.Util.csproj | 2 ++ .../Learun.Util/Learun.Util/Log/LogHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj index 78ebc041b..628f27c2b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj @@ -95,6 +95,7 @@ + @@ -154,6 +155,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs new file mode 100644 index 000000000..6261c1c0d --- /dev/null +++ b/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 + { + + + } + } + } +}