-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathLoggerScopeCall.cs
More file actions
34 lines (29 loc) · 1.1 KB
/
LoggerScopeCall.cs
File metadata and controls
34 lines (29 loc) · 1.1 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
using System.Collections.Immutable;
using AutoLoggerMessageGenerator.Utilities;
namespace AutoLoggerMessageGenerator.Models;
internal readonly record struct LoggerScopeCall(
CallLocation Location,
string Namespace,
string ClassName,
string MethodName,
string LogScopeMethodName,
string Message,
ImmutableArray<CallParameter> Parameters
)
{
public string GeneratedMethodName =>
IdentifierHelper.ToValidCSharpMethodName(
$"{Constants.LogScopeMethodPrefix}{Namespace}_{ClassName}_{MethodName}_{Location.Line}_{Location.Character}"
);
public bool Equals(LoggerScopeCall other) =>
Location.Equals(other.Location) &&
Namespace == other.Namespace &&
ClassName == other.ClassName &&
MethodName == other.MethodName &&
LogScopeMethodName == other.LogScopeMethodName &&
Message == other.Message &&
Parameters.SequenceEqual(other.Parameters);
public override int GetHashCode() =>
(Location, Namespace, ClassName, MethodName, LogScopeMethodName, Message, Parameters)
.GetHashCode();
};