Change Production Log Level
Remove `LoginAsync` And `LogoutAsync` And Update Status Directly In Events
This commit is contained in:
parent
c7409a90c5
commit
016027ff7b
@ -46,7 +46,7 @@ namespace qtc_api.Hubs
|
|||||||
if(!OnlineUsers.Any(e => e.Id == userId))
|
if(!OnlineUsers.Any(e => e.Id == userId))
|
||||||
{
|
{
|
||||||
OnlineUsers.Add(user.Data);
|
OnlineUsers.Add(user.Data);
|
||||||
await LoginAsync(user.Data);
|
if (user.Data.Status == 0) await UpdateStatusAsync(user.Data, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ namespace qtc_api.Hubs
|
|||||||
if(onlineUser != null)
|
if(onlineUser != null)
|
||||||
{
|
{
|
||||||
OnlineUsers.Remove(onlineUser);
|
OnlineUsers.Remove(onlineUser);
|
||||||
await LogoutAsync(onlineUser);
|
if (user.Data.Status >= 1) await UpdateStatusAsync(onlineUser, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,26 +199,6 @@ namespace qtc_api.Hubs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoginAsync(User user)
|
|
||||||
{
|
|
||||||
await UpdateStatusAsync(user, 1);
|
|
||||||
|
|
||||||
ServerConfig serverConfig = JsonDocument.Parse(File.ReadAllText("./ServerConfig.json")).Deserialize<ServerConfig>();
|
|
||||||
|
|
||||||
await Clients.Client(Context.ConnectionId).SendAsync("ReceiveServerConfig", serverConfig);
|
|
||||||
await Clients.All.SendAsync("RefreshUserLists");
|
|
||||||
|
|
||||||
Log($"User {user.Username} Has Logged In");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LogoutAsync(User user)
|
|
||||||
{
|
|
||||||
await UpdateStatusAsync(user, 0);
|
|
||||||
await Clients.All.SendAsync("RefreshUserLists");
|
|
||||||
|
|
||||||
Log($"User {user.Username} Has Logged Out");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Log(string message) => _logger.LogInformation(message);
|
private void Log(string message) => _logger.LogInformation(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Error",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user