some more logging improvements

This commit is contained in:
Gunter Labes 2008-01-15 03:15:04 +00:00
parent 9773c5bba6
commit 1a6e6303d9
2 changed files with 16 additions and 3 deletions

View File

@ -730,7 +730,7 @@ bool game::end_turn() {
if (description_ == NULL) {
return false;
}
description_->values["turn"] = describe_turns(turn, level()["turns"]);
(*description_)["turn"] = describe_turns(turn, level_["turns"]);
return true;
}
@ -821,6 +821,9 @@ bool game::remove_player(const network::connection player, const bool disconnect
LOG_GAME << network::ip_address(user->first) << "\t" << user->second.name()
<< (game_ended ? (started_ ? "\tended" : "\taborted") : "\thas left")
<< " game:\t\"" << name_ << "\" (" << id_ << ")"
<< (game_ended && started_ ? " at turn: "
+ (description_ ? (*description_)["turn"] : "-/-")
+ " with reason: '" + termination_reason() + "'" : "")
<< (observer ? " as an observer" : "")
<< (disconnect ? " and disconnected" : "")
<< ". (socket: " << user->first << ")\n";
@ -831,7 +834,7 @@ bool game::remove_player(const network::connection player, const bool disconnect
if (observer) {
//they're just an observer, so send them having quit to clients
config observer_quit;
observer_quit.add_child("observer_quit").values["name"] = user->second.name();
observer_quit.add_child("observer_quit")["name"] = user->second.name();
send_data(observer_quit);
} else {
const config& msg = construct_server_message(user->second.name()

View File

@ -1147,7 +1147,11 @@ void server::process_data_game(const network::connection sock, const config& dat
|| (g->is_owner(sock) && !g->started())) {
LOG_SERVER << network::ip_address(sock) << "\t" << pl->second.name()
<< (g->started() ? "\tended game:\t\"" : "\taborted game:\t\"")
<< g->name() << "\" (" << g->id() << ").\n";
<< g->name() << "\" (" << g->id() << ")"
<< (g->started() ? " at turn: "
+ (g->description() ? (*g->description())["turn"] : "-/-")
+ " with reason: '" + g->termination_reason() + "'" : "")
<< ".\n";
// Remove the player in delete_game() with all other remaining
// ones so he gets the updated gamelist.
delete_game(g);
@ -1227,6 +1231,12 @@ void server::process_data_game(const network::connection sock, const config& dat
const config& info = *data.child("info");
if (info["type"] == "termination") {
g->set_termination_reason(info["condition"]);
if (info["condition"] == "out of sync") {
// May be too noisy..
LOG_SERVER << network::ip_address(sock) << pl->second.name()
<< "\treports an out of sync error in game:\t\""
<< g->name() << "\" (" << g->id() << ").\n";
}
}
return;
} else if (data.child("turn")) {