forked from grandnode/grandnode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNullLogger.cs
92 lines (85 loc) · 3.02 KB
/
NullLogger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using Grand.Core;
using Grand.Core.Domain.Customers;
using Grand.Core.Domain.Logging;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Grand.Services.Logging
{
/// <summary>
/// Null logger
/// </summary>
public partial class NullLogger : ILogger
{
/// <summary>
/// Determines whether a log level is enabled
/// </summary>
/// <param name="level">Log level</param>
/// <returns>Result</returns>
public virtual bool IsEnabled(LogLevel level)
{
return false;
}
/// <summary>
/// Deletes a log item
/// </summary>
/// <param name="log">Log item</param>
public virtual async Task DeleteLog(Log log)
{
await Task.CompletedTask;
}
/// <summary>
/// Clears a log
/// </summary>
public virtual async Task ClearLog()
{
await Task.CompletedTask;
}
/// <summary>
/// Gets all log items
/// </summary>
/// <param name="fromUtc">Log item creation from; null to load all records</param>
/// <param name="toUtc">Log item creation to; null to load all records</param>
/// <param name="message">Message</param>
/// <param name="logLevel">Log level; null to load all records</param>
/// <param name="pageIndex">Page index</param>
/// <param name="pageSize">Page size</param>
/// <returns>Log item items</returns>
public virtual async Task<IPagedList<Log>> GetAllLogs(DateTime? fromUtc = null, DateTime? toUtc = null,
string message = "", LogLevel? logLevel = null,
int pageIndex = 0, int pageSize = int.MaxValue)
{
return await Task.FromResult(new PagedList<Log>(new List<Log>(), pageIndex, pageSize));
}
/// <summary>
/// Gets a log item
/// </summary>
/// <param name="logId">Log item identifier</param>
/// <returns>Log item</returns>
public virtual Task<Log> GetLogById(string logId)
{
return null;
}
/// <summary>
/// Get log items by identifiers
/// </summary>
/// <param name="logIds">Log item identifiers</param>
/// <returns>Log items</returns>
public virtual async Task<IList<Log>> GetLogByIds(string[] logIds)
{
return await Task.FromResult(new List<Log>());
}
/// <summary>
/// Inserts a log item
/// </summary>
/// <param name="logLevel">Log level</param>
/// <param name="shortMessage">The short message</param>
/// <param name="fullMessage">The full message</param>
/// <param name="customer">The customer to associate log record with</param>
/// <returns>A log item</returns>
public virtual Task<Log> InsertLog(LogLevel logLevel, string shortMessage, string fullMessage = "", Customer customer = null)
{
return null;
}
}
}