Repository navigation
Expand file tree
/
Copy pathLoggingExtensions.cs
More file actions
85 lines (75 loc) · 3.23 KB
/
Copy pathLoggingExtensions.cs
File metadata and controls
85 lines (75 loc) · 3.23 KB
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
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.Extensions.Logging
{
internal static class LoggingExtensions
{
private static Action<ILogger, Exception> _signInWithoutWresult;
private static Action<ILogger, Exception> _signInWithoutToken;
private static Action<ILogger, Exception> _exceptionProcessingMessage;
private static Action<ILogger, string, Exception> _malformedRedirectUri;
private static Action<ILogger, Exception> _remoteSignOutHandledResponse;
private static Action<ILogger, Exception> _remoteSignOutSkipped;
private static Action<ILogger, Exception> _remoteSignOut;
static LoggingExtensions()
{
_signInWithoutWresult = LoggerMessage.Define(
eventId: 1,
logLevel: LogLevel.Debug,
formatString: "Received a sign-in message without a WResult.");
_signInWithoutToken = LoggerMessage.Define(
eventId: 2,
logLevel: LogLevel.Debug,
formatString: "Received a sign-in message without a token.");
_exceptionProcessingMessage = LoggerMessage.Define(
eventId: 3,
logLevel: LogLevel.Error,
formatString: "Exception occurred while processing message.");
_malformedRedirectUri = LoggerMessage.Define<string>(
eventId: 4,
logLevel: LogLevel.Warning,
formatString: "The sign-out redirect URI '{0}' is malformed.");
_remoteSignOutHandledResponse = LoggerMessage.Define(
eventId: 5,
logLevel: LogLevel.Debug,
formatString: "RemoteSignOutContext.HandledResponse");
_remoteSignOutSkipped = LoggerMessage.Define(
eventId: 6,
logLevel: LogLevel.Debug,
formatString: "RemoteSignOutContext.Skipped");
_remoteSignOut = LoggerMessage.Define(
eventId: 7,
logLevel: LogLevel.Information,
formatString: "Remote signout request processed.");
}
public static void SignInWithoutWresult(this ILogger logger)
{
_signInWithoutWresult(logger, null);
}
public static void SignInWithoutToken(this ILogger logger)
{
_signInWithoutToken(logger, null);
}
public static void ExceptionProcessingMessage(this ILogger logger, Exception ex)
{
_exceptionProcessingMessage(logger, ex);
}
public static void MalformedRedirectUri(this ILogger logger, string uri)
{
_malformedRedirectUri(logger, uri, null);
}
public static void RemoteSignOutHandledResponse(this ILogger logger)
{
_remoteSignOutHandledResponse(logger, null);
}
public static void RemoteSignOutSkipped(this ILogger logger)
{
_remoteSignOutSkipped(logger, null);
}
public static void RemoteSignOut(this ILogger logger)
{
_remoteSignOut(logger, null);
}
}
}