懒得勤快 пре 7 година
родитељ
комит
f04c422fd6

+ 39 - 3
Masuit.Tools.Core/Logging/LogInfo.cs

@@ -2,18 +2,54 @@
 
 namespace Masuit.Tools.Core.Logging
 {
+    /// <summary>
+    /// 日志信息
+    /// </summary>
     public class LogInfo
     {
+        /// <summary>
+        /// 时间
+        /// </summary>
         public DateTime Time { get; set; }
+
+        /// <summary>
+        /// 线程id
+        /// </summary>
         public int ThreadId { get; set; }
+
+        /// <summary>
+        /// 日志级别
+        /// </summary>
         public LogLevel LogLevel { get; set; }
+
+        /// <summary>
+        /// 异常源
+        /// </summary>
         public string Source { get; set; }
+
+        /// <summary>
+        /// 异常信息
+        /// </summary>
         public string Message { get; set; }
-    }
 
-    public class LogError : LogInfo
-    {
+        /// <summary>
+        /// 异常对象
+        /// </summary>
         public Exception Exception { get; set; }
+
+        /// <summary>
+        /// 日志类型
+        /// </summary>
         public string ExceptionType { get; set; }
+
+        /// <summary>
+        /// 请求路径
+        /// </summary>
+        public string RequestUrl { get; set; }
+
+        /// <summary>
+        /// 客户端代理
+        /// </summary>
+        public string UserAgent { get; set; }
     }
 }

+ 10 - 10
Masuit.Tools.Core/Logging/LogManager.cs

@@ -180,7 +180,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Error(Exception error)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {error.Source}  {error.Message}{Environment.NewLine}{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {error.Source}  {error.StackTrace}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Error,
                 Message = error.Message,
@@ -201,7 +201,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Error(Type source, Exception error)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {source.FullName}  {error.Message}{Environment.NewLine}{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {source.FullName}  {error.StackTrace}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Error,
                 Message = error.Message,
@@ -222,7 +222,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Error(Type source, string error)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {source.FullName}  {error}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Error,
                 Message = error,
@@ -243,7 +243,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Error(string source, Exception error)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {source}  {error.Message}{Environment.NewLine}{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {source}  {error.StackTrace}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Error,
                 Message = error.Message,
@@ -264,7 +264,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Error(string source, string error)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(error).ToUpper()}   {source}  {error}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Error,
                 Message = error,
@@ -284,7 +284,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Fatal(Exception fatal)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {fatal.Source}  {fatal.Message}{Environment.NewLine}{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {fatal.Source}  {fatal.StackTrace}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Fatal,
                 Message = fatal.Message,
@@ -305,7 +305,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Fatal(Type source, Exception fatal)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {source.FullName}  {fatal.Message}{Environment.NewLine}{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {source.FullName}  {fatal.StackTrace}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Fatal,
                 Message = fatal.Message,
@@ -326,7 +326,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Fatal(Type source, string fatal)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {source.FullName}  {fatal}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Fatal,
                 Message = fatal,
@@ -347,7 +347,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Fatal(string source, Exception fatal)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {source}  {fatal.Message}{Environment.NewLine}{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {source}  {fatal.StackTrace}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Fatal,
                 Message = fatal.Message,
@@ -368,7 +368,7 @@ namespace Masuit.Tools.Core.Logging
         public static void Fatal(string source, string fatal)
         {
             LogQueue.Enqueue(new Tuple<string, string>(GetLogPath(), $"{DateTime.Now}   [{Thread.CurrentThread.ManagedThreadId}]   {nameof(fatal).ToUpper()}   {source}  {fatal}"));
-            LogInfo log = new LogError()
+            LogInfo log = new LogInfo()
             {
                 LogLevel = LogLevel.Fatal,
                 Message = fatal,

+ 0 - 8
Masuit.Tools.Core/Logging/WebLogInfo.cs

@@ -1,8 +0,0 @@
-namespace Masuit.Tools.Core.Logging
-{
-    public class WebLogInfo : LogError
-    {
-        public string RequestUrl { get; set; }
-        public string UserAgent { get; set; }
-    }
-}

+ 1 - 1
Masuit.Tools.Core/Masuit.Tools.Core.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netcoreapp2.0</TargetFramework>
-    <Version>2.0</Version>
+    <Version>2.0.1</Version>
     <Authors>懒得勤快</Authors>
     <Company>masuit.com</Company>
     <Description>包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。

+ 39 - 3
Masuit.Tools/Logging/LogInfo.cs

@@ -2,18 +2,54 @@
 
 namespace Masuit.Tools.Logging
 {
+    /// <summary>
+    /// 日志信息
+    /// </summary>
     public class LogInfo
     {
+        /// <summary>
+        /// 时间
+        /// </summary>
         public DateTime Time { get; set; }
+
+        /// <summary>
+        /// 线程id
+        /// </summary>
         public int ThreadId { get; set; }
+
+        /// <summary>
+        /// 日志级别
+        /// </summary>
         public LogLevel LogLevel { get; set; }
+
+        /// <summary>
+        /// 异常源
+        /// </summary>
         public string Source { get; set; }
+
+        /// <summary>
+        /// 异常信息
+        /// </summary>
         public string Message { get; set; }
-    }
 
-    public class LogError : LogInfo
-    {
+        /// <summary>
+        /// 异常对象
+        /// </summary>
         public Exception Exception { get; set; }
+
+        /// <summary>
+        /// 日志类型
+        /// </summary>
         public string ExceptionType { get; set; }
+
+        /// <summary>
+        /// 请求路径
+        /// </summary>
+        public string RequestUrl { get; set; }
+
+        /// <summary>
+        /// 客户端代理
+        /// </summary>
+        public string UserAgent { get; set; }
     }
 }

+ 0 - 8
Masuit.Tools/Logging/WebLogInfo.cs

@@ -1,8 +0,0 @@
-namespace Masuit.Tools.Logging
-{
-    public class WebLogInfo : LogError
-    {
-        public string RequestUrl { get; set; }
-        public string UserAgent { get; set; }
-    }
-}

+ 0 - 1
Masuit.Tools/Masuit.Tools.csproj

@@ -97,7 +97,6 @@
     <Compile Include="Logging\LogInfo.cs" />
     <Compile Include="Logging\LogLevel.cs" />
     <Compile Include="Logging\LogManager.cs" />
-    <Compile Include="Logging\WebLogInfo.cs" />
     <Compile Include="Models\BaiduIP.cs" />
     <Compile Include="Models\IspInfo.cs" />
     <Compile Include="Models\PhysicsAddress.cs" />