This repository has been archived by the owner on Feb 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathRequestLogger.cs
83 lines (69 loc) · 1.89 KB
/
RequestLogger.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
namespace PackageManagement
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using chocolatey.infrastructure.logging;
using PackageManagement.Sdk;
public class RequestLogger : ILog
{
private readonly Request _request;
public RequestLogger(Request request)
{
_request = request;
}
public void InitializeFor(string loggerName)
{
// TODO: I don't think I'm allowed to do this
}
public void Debug(string message, params object[] formatting)
{
_request.Debug(message, formatting);
}
public void Debug(Func<string> message)
{
_request.Debug(message.Invoke());
}
public void Info(string message, params object[] formatting)
{
_request.Verbose(message, formatting);
}
public void Info(Func<string> message)
{
_request.Verbose(message.Invoke());
}
public void Warn(string message, params object[] formatting)
{
_request.Warning(message, formatting);
}
public void Warn(Func<string> message)
{
_request.Warning(message.Invoke());
}
public void Error(string id, string category, string targetObject, string message)
{
_request.Error(id, category, targetObject, message);
}
public void Error(ErrorCategory category, string targetObject, string message, params object[] formatting)
{
_request.Error(category, targetObject, message, formatting);
}
public void Error(string message, params object[] formatting)
{
_request.Error(ErrorCategory.NotSpecified, "", message, formatting);
}
public void Error(Func<string> message)
{
_request.Error(ErrorCategory.NotSpecified, "", message.Invoke());
}
public void Fatal(string message, params object[] formatting)
{
_request.Error(ErrorCategory.NotSpecified, "FATAL", message, formatting);
}
public void Fatal(Func<string> message)
{
_request.Error(ErrorCategory.NotSpecified, "FATAL", message.Invoke());
}
}
}