Skip to content

Commit d19ad90

Browse files
committed
[feat] 新增ILogProvider,写日志接口。支持写应用功能日志
1 parent df37000 commit d19ad90

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

NewLife.Core/Caching/MemoryCache.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using NewLife.Serialization;
99
using NewLife.Threading;
1010

11-
//#nullable enable
1211
namespace NewLife.Caching;
1312

1413
/// <summary>缓存键事件参数</summary>
@@ -1031,5 +1030,4 @@ public IEnumerable<T> Take(Int32 count = 1)
10311030
/// <param name="keys"></param>
10321031
/// <returns></returns>
10331032
public Int32 Acknowledge(params String[] keys) => 0;
1034-
}
1035-
//#nullable restore
1033+
}

NewLife.Core/Common/DisposeBase.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Xml.Serialization;
55
using NewLife.Log;
66

7-
#nullable enable
87
namespace NewLife;
98

109
/// <summary>具有是否已释放和释放后事件的接口</summary>
@@ -156,5 +155,4 @@ public static class DisposeHelper
156155

157156
return obj;
158157
}
159-
}
160-
#nullable restore
158+
}

NewLife.Core/Log/ILog.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#nullable enable
2-
namespace NewLife.Log;
1+
namespace NewLife.Log;
32

43
/// <summary>日志接口</summary>
54
/// <remarks>
@@ -43,5 +42,4 @@ public interface ILog
4342

4443
/// <summary>日志等级,只输出大于等于该级别的日志,默认Info</summary>
4544
LogLevel Level { get; set; }
46-
}
47-
#nullable restore
45+
}

NewLife.Core/Log/ILogFeature.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
namespace NewLife.Log;
22

3+
/// <summary>写日志接口。支持写应用功能日志</summary>
4+
public interface ILogProvider
5+
{
6+
/// <summary>写日志</summary>
7+
/// <param name="action">动作</param>
8+
/// <param name="success">是否成功</param>
9+
/// <param name="content">内容</param>
10+
void WriteLog(String action, Boolean success, String content);
11+
}
12+
313
/// <summary>日志功能接口</summary>
414
public interface ILogFeature
515
{
@@ -14,5 +24,5 @@ public static class LogFeatureExtensions
1424
/// <param name="logFeature">日志功能</param>
1525
/// <param name="format">格式化字符串</param>
1626
/// <param name="args">格式化参数,特殊处理时间日期和异常对象</param>
17-
public static void WriteLog(ILogFeature logFeature, String format, params Object?[] args) => logFeature.Log?.Info(format, args);
27+
public static void WriteLog(this ILogFeature logFeature, String format, params Object?[] args) => logFeature.Log?.Info(format, args);
1828
}

NewLife.Core/Log/XTrace.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
using NewLife.Threading;
1313
using NewLife.Windows;
1414

15-
#nullable enable
16-
1715
namespace NewLife.Log;
1816

1917
/// <summary>日志类,包含跟踪调试功能</summary>
@@ -417,6 +415,4 @@ public static void WriteVersion(this Assembly asm)
417415
}
418416

419417
#endregion 版本信息
420-
}
421-
422-
#nullable restore
418+
}

0 commit comments

Comments
 (0)