mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
add logging of invites (#2005)
* add logging of invites * required changes * revert not needed changes * remove not needed convertation
This commit is contained in:
@@ -2161,6 +2161,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
foreach (SteamFriends.FriendsListCallback.Friend friend in callback.FriendList.Where(friend => friend.Relationship == EFriendRelationship.RequestRecipient)) {
|
||||
ArchiLogger.LogInvite(friend.SteamID);
|
||||
|
||||
switch (friend.SteamID.AccountType) {
|
||||
case EAccountType.Clan when IsMasterClanID(friend.SteamID):
|
||||
ArchiHandler.AcknowledgeClanInvite(friend.SteamID, true);
|
||||
|
||||
@@ -26,6 +26,7 @@ using System.Threading.Tasks;
|
||||
using ArchiSteamFarm.Localization;
|
||||
using JetBrains.Annotations;
|
||||
using NLog;
|
||||
using SteamKit2;
|
||||
|
||||
namespace ArchiSteamFarm.NLog {
|
||||
public sealed class ArchiLogger {
|
||||
@@ -151,6 +152,20 @@ namespace ArchiSteamFarm.NLog {
|
||||
Logger.Log(logEventInfo);
|
||||
}
|
||||
|
||||
internal void LogInvite(SteamID steamID, [CallerMemberName] string? previousMethodName = null) {
|
||||
if ((steamID.AccountType == EAccountType.Invalid) || (steamID == 0)) {
|
||||
throw new ArgumentNullException(nameof(steamID) + " || " + nameof(steamID.AccountType));
|
||||
}
|
||||
|
||||
string loggedMessage = previousMethodName + "() " + steamID.AccountType + " " + steamID.ConvertToUInt64().ToString();
|
||||
|
||||
LogEventInfo logEventInfo = new LogEventInfo(LogLevel.Trace, Logger.Name, loggedMessage);
|
||||
logEventInfo.Properties["SteamID"] = steamID.ConvertToUInt64();
|
||||
logEventInfo.Properties["AccountType"] = steamID.AccountType;
|
||||
|
||||
Logger.Log(logEventInfo);
|
||||
}
|
||||
|
||||
internal async Task LogFatalException(Exception exception, [CallerMemberName] string? previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
|
||||
Reference in New Issue
Block a user