added basic logging

This commit is contained in:
Nicolas Constant 2021-05-28 23:13:22 -04:00
parent a9a59eb433
commit 9686d6187d
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 33 additions and 5 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
@ -212,9 +213,19 @@ namespace BSLManager
{
Application.MainLoop.Invoke(async () =>
{
var userToDelete = _state.GetElementAt(el);
await _removeFollowerAction.ProcessAsync(userToDelete);
_state.RemoveAt(el);
try
{
var userToDelete = _state.GetElementAt(el);
BasicLogger.Log($"Delete {userToDelete.Acct}@{userToDelete.Host}");
await _removeFollowerAction.ProcessAsync(userToDelete);
BasicLogger.Log($"Remove user from list");
_state.RemoveAt(el);
}
catch (Exception e)
{
BasicLogger.Log(e.Message);
}
ConsoleGui.RefreshUI();
});

View File

@ -0,0 +1,13 @@
using System;
using System.IO;
namespace BSLManager.Tools
{
public static class BasicLogger
{
public static void Log(string log)
{
File.AppendAllLines($"Log-{Guid.NewGuid()}.txt", new []{ log });
}
}
}

View File

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using BirdsiteLive.DAL.Contracts;
using BirdsiteLive.Domain.Repository;
using BirdsiteLive.Moderation.Actions;
@ -38,7 +39,10 @@ namespace BirdsiteLive.Moderation.Processors
if (type == ModerationTypeEnum.WhiteListing && status != ModeratedTypeEnum.WhiteListed ||
type == ModerationTypeEnum.BlackListing && status == ModeratedTypeEnum.BlackListed)
{
Console.WriteLine($"Remove {followerHandle}");
await _removeFollowerAction.ProcessAsync(follower);
}
}
}
}