Implement cuddle logger

This commit is contained in:
jvyden 2022-05-01 17:37:58 -04:00
parent 9c57d15671
commit 9fa4ffbc90
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
41 changed files with 508 additions and 317 deletions

View file

@ -1,7 +1,6 @@
#nullable enable
using System.Threading.Tasks;
using JetBrains.Annotations;
using Kettu;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Logging;
using LBPUnion.ProjectLighthouse.Types;
@ -25,17 +24,17 @@ public class CreateUserCommand : ICommand
if (user == null)
{
user = await this._database.CreateUser(onlineId, CryptoHelper.BCryptHash(password));
Logger.Log($"Created user {user.UserId} with online ID (username) {user.Username} and the specified password.", LoggerLevelLogin.Instance);
Logger.LogSuccess($"Created user {user.UserId} with online ID (username) {user.Username} and the specified password.", "Login");
user.PasswordResetRequired = true;
Logger.Log("This user will need to reset their password when they log in.", LoggerLevelLogin.Instance);
Logger.LogInfo("This user will need to reset their password when they log in.", "Login");
await this._database.SaveChangesAsync();
Logger.Log("Database changes saved.", LoggerLevelDatabase.Instance);
Logger.LogInfo("Database changes saved.", "Database");
}
else
{
Logger.Log("A user with this username already exists.", LoggerLevelLogin.Instance);
Logger.LogError("A user with this username already exists.", "Login");
}
}