-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathLoggerExtensions.cs
More file actions
25 lines (22 loc) · 956 Bytes
/
LoggerExtensions.cs
File metadata and controls
25 lines (22 loc) · 956 Bytes
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
namespace VariantAndAzureMonitorDemo
{
public static class LoggerExtensions
{
private static readonly Action<ILogger, string, int, Exception?> _vote = LoggerMessage.Define<string, int>(
LogLevel.Information,
new EventId(1, "microsoft.custom_event.name"),
"{microsoft.custom_event.name} {ImageRating}");
private static readonly Action<ILogger, string, string, long, Exception?> _checkout = LoggerMessage.Define<string, string, long>(
LogLevel.Information,
new EventId(1, "microsoft.custom_event.name"),
"{microsoft.custom_event.name} {success} {amount}");
public static void LogVote(this ILogger logger, int rating)
{
_vote(logger, "Vote", rating, null);
}
public static void LogCheckout(this ILogger logger, long amount)
{
_checkout(logger, "checkout", "yes", amount, null);
}
}
}