From 6d1b642dac18aeb1f2de3237e9b942e2b4a3d518 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Tue, 3 Sep 2024 13:48:02 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20feat(=E4=BC=98=E5=8C=96):=20?= =?UTF-8?q?=E7=AE=80=E5=8C=96=E6=97=A5=E5=BF=97=E6=A0=BC=E5=BC=8F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE;=E7=AE=80=E5=8C=96=E8=BE=93=E5=87=BA=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/GitCommitMessageStorage.xml | 14 +------------- Bunny.Common/Context/Middleware/MinioContext.cs | 2 +- Bunny.Dao/Common/Constant/ExceptionConstant.cs | 2 +- Bunny.Test.Until/Test/Test1.cs | 12 ++++++++---- Bunny.WebApi.sln.DotSettings.user | 5 +++-- Bunny.WebApi/Configuration/BaseConfig.cs | 4 ++-- Bunny.WebApi/Configuration/Log4NetConfiguration.cs | 14 -------------- 7 files changed, 16 insertions(+), 37 deletions(-) delete mode 100644 Bunny.WebApi/Configuration/Log4NetConfiguration.cs diff --git a/.idea/.idea.Bunny.WebApi/.idea/GitCommitMessageStorage.xml b/.idea/.idea.Bunny.WebApi/.idea/GitCommitMessageStorage.xml index 3b56900..e4fd56a 100644 --- a/.idea/.idea.Bunny.WebApi/.idea/GitCommitMessageStorage.xml +++ b/.idea/.idea.Bunny.WebApi/.idea/GitCommitMessageStorage.xml @@ -2,19 +2,7 @@ \ No newline at end of file diff --git a/Bunny.Common/Context/Middleware/MinioContext.cs b/Bunny.Common/Context/Middleware/MinioContext.cs index 1d0f049..abca19a 100644 --- a/Bunny.Common/Context/Middleware/MinioContext.cs +++ b/Bunny.Common/Context/Middleware/MinioContext.cs @@ -19,6 +19,6 @@ public static class MinioContext MinioClient = new MinioClient().WithEndpoint(endpoint).WithCredentials(accessKey, secretKey) // .WithSSL() // 使用HTTPS .Build(); - Log.Info($"Minio 初始化...\n初始化桶:{BucketName}"); + Log.Info($"Minio 初始化...\t初始化桶:{BucketName}"); } } \ No newline at end of file diff --git a/Bunny.Dao/Common/Constant/ExceptionConstant.cs b/Bunny.Dao/Common/Constant/ExceptionConstant.cs index 54a1ce1..da21f14 100644 --- a/Bunny.Dao/Common/Constant/ExceptionConstant.cs +++ b/Bunny.Dao/Common/Constant/ExceptionConstant.cs @@ -3,7 +3,7 @@ /// /// 错误常量 /// -public class ExceptionConstant +public static class ExceptionConstant { public const string FileSystemException = "文件系统错误"; public const string UnknownException = "未知错误"; diff --git a/Bunny.Test.Until/Test/Test1.cs b/Bunny.Test.Until/Test/Test1.cs index 3d7fcf2..ef031ae 100644 --- a/Bunny.Test.Until/Test/Test1.cs +++ b/Bunny.Test.Until/Test/Test1.cs @@ -1,5 +1,4 @@ -using System.Net; -using NUnit.Framework; +using NUnit.Framework; namespace Bunny.Test.Until.Test; @@ -52,9 +51,14 @@ public class Test1 foreach (var i in arg) Console.WriteLine(i); } - private static void Method1() + [Test] + public void Method1() { - Console.WriteLine("Method1"); + var s = Guid.NewGuid().ToString(); + Console.WriteLine(s); + + var guid = Guid.Parse("9b7cbd24-cf3d-4944-ab5b-9cf5278a5921"); + Console.WriteLine(guid); } private static void Method2() diff --git a/Bunny.WebApi.sln.DotSettings.user b/Bunny.WebApi.sln.DotSettings.user index 8f91ddd..d51c318 100644 --- a/Bunny.WebApi.sln.DotSettings.user +++ b/Bunny.WebApi.sln.DotSettings.user @@ -19,7 +19,7 @@ <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.JobTest.JobTest1.TestJob</TestId> </TestAncestor> </SessionState> - <SessionState ContinuousTestingMode="0" Name="TestJob #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <SessionState ContinuousTestingMode="0" IsActive="True" Name="TestJob #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> <TestAncestor> <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.JobTest.JobTest1.TestJob</TestId> <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.Test.Test1.Start</TestId> @@ -27,7 +27,7 @@ <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.NetUtilTest.NetTest2</TestId> </TestAncestor> </SessionState> - <SessionState ContinuousTestingMode="0" IsActive="True" Name="Test1" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <SessionState ContinuousTestingMode="0" Name="Test1" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> <Or> <And> <TestAncestor> @@ -48,6 +48,7 @@ <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.JobTest.JobTest1.TestJob</TestId> <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.Test.Test1.Start</TestId> <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.NetUtilTest.NetTest2</TestId> + <TestId>NUnit3x::945BE294-8057-40EE-9A98-5598D1A728B9::net8.0::Bunny.Test.Until.Test.Test1.Method1</TestId> </TestAncestor> </Or> </SessionState> diff --git a/Bunny.WebApi/Configuration/BaseConfig.cs b/Bunny.WebApi/Configuration/BaseConfig.cs index a1284a0..bce8e81 100644 --- a/Bunny.WebApi/Configuration/BaseConfig.cs +++ b/Bunny.WebApi/Configuration/BaseConfig.cs @@ -17,9 +17,9 @@ public class BaseConfig(WebApplicationBuilder builder) { // 配置跨域 UseCors(); + // 配置日志相关 - // builder.Logging.AddLog4Net("Configuration/log4net.config"); - Log4NetConfiguration.ConfigureLog4Net("Configuration/log4net.config"); + builder.Logging.AddLog4Net("Configuration/log4net.config"); // 自定义时间格式 builder.Services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new JsonDateTimeConverter())); diff --git a/Bunny.WebApi/Configuration/Log4NetConfiguration.cs b/Bunny.WebApi/Configuration/Log4NetConfiguration.cs deleted file mode 100644 index cd882ac..0000000 --- a/Bunny.WebApi/Configuration/Log4NetConfiguration.cs +++ /dev/null @@ -1,14 +0,0 @@ -using log4net; -using log4net.Config; - -namespace Bunny.WebApi.Configuration; - -public class Log4NetConfiguration -{ - private static readonly ILog Log = LogManager.GetLogger(typeof(Log4NetConfiguration)); - - public static void ConfigureLog4Net(string configFilePath) - { - XmlConfigurator.Configure(new FileInfo(configFilePath)); - } -} \ No newline at end of file