Implement robust logging with flexi_logger and update CI to verify logs
Some checks failed
Smoke tests / Build and smoke test (push) Failing after 1m21s
Smoke tests / Build and smoke test (pull_request) Failing after 1m21s

This commit is contained in:
AI Agent
2026-03-19 18:04:32 -06:00
parent 678543dd9a
commit 3bd180494e
7 changed files with 122 additions and 129 deletions

View File

@@ -74,6 +74,7 @@ async fn admin_promote(target: &str, state: &SharedState) -> CommandResult {
if target.is_empty() {
return simple(&format!("{}\r\n", ansi::error_msg("Usage: admin promote <player>")));
}
log::info!("Admin action: promote player '{}'", target);
let st = state.lock().await;
if st.db.set_admin(target, true) {
// Also update in-memory if online
@@ -124,6 +125,7 @@ async fn admin_demote(target: &str, state: &SharedState) -> CommandResult {
if target.is_empty() {
return simple(&format!("{}\r\n", ansi::error_msg("Usage: admin demote <player>")));
}
log::info!("Admin action: demote player '{}'", target);
let st = state.lock().await;
if st.db.set_admin(target, false) {
simple(&format!(
@@ -142,6 +144,7 @@ async fn admin_kick(target: &str, player_id: usize, state: &SharedState) -> Comm
if target.is_empty() {
return simple(&format!("{}\r\n", ansi::error_msg("Usage: admin kick <player>")));
}
log::info!("Admin action: kick player '{}'", target);
let mut st = state.lock().await;
let low = target.to_lowercase();
@@ -237,6 +240,7 @@ async fn admin_teleport(room_id: &str, player_id: usize, state: &SharedState) ->
ansi::error_msg("Usage: admin teleport <room_id>")
));
}
log::info!("Admin action: teleport player ID {} to '{}'", player_id, room_id);
let mut st = state.lock().await;
if st.world.get_room(room_id).is_none() {
let rooms: Vec<&String> = st.world.rooms.keys().collect();
@@ -329,6 +333,7 @@ async fn admin_teleport(room_id: &str, player_id: usize, state: &SharedState) ->
}
async fn admin_registration(args: &str, state: &SharedState) -> CommandResult {
log::info!("Admin action: registration setting updated: '{}'", args);
let st = state.lock().await;
match args.to_lowercase().as_str() {
"on" | "true" | "open" => {
@@ -365,6 +370,7 @@ async fn admin_announce(msg: &str, player_id: usize, state: &SharedState) -> Com
ansi::error_msg("Usage: admin announce <message>")
));
}
log::info!("Admin action: announcement by player ID {}: '{}'", player_id, msg);
let st = state.lock().await;
let announcement = CryptoVec::from(
format!(
@@ -405,6 +411,7 @@ async fn admin_announce(msg: &str, player_id: usize, state: &SharedState) -> Com
}
async fn admin_heal(args: &str, player_id: usize, state: &SharedState) -> CommandResult {
log::info!("Admin action: heal player '{}' (empty means self)", args);
let mut st = state.lock().await;
if args.is_empty() {
@@ -564,6 +571,7 @@ async fn admin_info(target: &str, state: &SharedState) -> CommandResult {
}
async fn admin_setattitude(args: &str, state: &SharedState) -> CommandResult {
log::info!("Admin action: setattitude '{}'", args);
let parts: Vec<&str> = args.splitn(3, ' ').collect();
if parts.len() < 3 {
return simple(&format!(