-
Notifications
You must be signed in to change notification settings - Fork 0
/
ILogWriter.cs
68 lines (63 loc) · 1.77 KB
/
ILogWriter.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
namespace SystemLibrary.Common.Web;
/// <summary>
/// ILogWriter is responsible for storing log messages
///
/// - Create a new class that implements ILogWriter
/// - Register your class as singleton implementation of the ILogWriter
/// </summary>
/// <example>
/// Program.cs/Startup.cs:
/// <code class="language-csharp hljs">
/// public void ConfigureServices(IServiceCollection services)
/// {
/// services.AddSingleton(typeof(YourLogWriter), typeof(ILogWriter));
/// }
/// </code>
///
/// Your LogWriter implementation:
/// <code>
/// public class YourLogWriter : ILogWriter
/// {
/// public void Error(string message)
/// {
/// //Write message to slack? CloudWatch? Sentry.io? Local disc? Its up to you
/// }
/// ...
/// }
/// </code>
///
/// Usage
/// <code>
/// Log.Error("hello world");
/// Log.Warning("hello world");
/// Log.Debug("hello world");
/// Log.Info("hello world");
/// Log.Write("hello world");
/// </code>
/// All calls to method in 'Log' will create a message, append various data, and pass it to your log writer
/// </example>
public interface ILogWriter
{
/// <summary>
/// Implement the writing of error messages
/// </summary>
void Error(string message);
/// <summary>
/// Implement the writing of warning messages
/// </summary>
void Warning(string message);
/// <summary>
/// Implement the writing of debug messages
/// </summary>
void Debug(string message);
/// <summary>
/// Implement the writing of info messages
/// </summary>
void Info(string message);
/// <summary>
/// Implement the writing of warning messages
///
/// Note: Write() will always be invoked, even if you disable logging in appSettings
/// </summary>
void Write(string message);
}