-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathLogMessageCall.cs
More file actions
38 lines (33 loc) · 1.21 KB
/
LogMessageCall.cs
File metadata and controls
38 lines (33 loc) · 1.21 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
using System.Collections.Immutable;
using AutoLoggerMessageGenerator.Utilities;
namespace AutoLoggerMessageGenerator.Models;
internal readonly record struct LogMessageCall(
// Need this property for backtracking diagnostic reports
Guid Id,
CallLocation Location,
string Namespace,
string ClassName,
string MethodName,
string LogMethodName,
string LogLevel,
string Message,
ImmutableArray<CallParameter> Parameters
)
{
public string GeneratedMethodName =>
IdentifierHelper.ToValidCSharpMethodName(
$"{Constants.LogMethodPrefix}{Namespace}_{ClassName}_{MethodName}_{Location.Line}_{Location.Character}"
);
public bool Equals(LogMessageCall other) =>
Location.Equals(other.Location) &&
Namespace == other.Namespace &&
ClassName == other.ClassName &&
MethodName == other.MethodName &&
LogMethodName == other.LogMethodName &&
LogLevel == other.LogLevel &&
Message == other.Message &&
Parameters.SequenceEqual(other.Parameters);
public override int GetHashCode() =>
(Location, Namespace, ClassName, MethodName, LogMethodName, LogLevel, Message, Parameters)
.GetHashCode();
};