Eliminate stdostream (finally, that was awful.)

This commit is contained in:
2025-12-15 22:42:02 -05:00
parent f528ba69fe
commit 9dc974ebca
6 changed files with 46 additions and 51 deletions

View File

@@ -49,7 +49,7 @@ public:
admin_id_ = master_->create_login_actor();
// Print out admin ID for debugging purposes.
stdostream() << "Admin actor id = " << admin_id_ << std::endl;
util::dprint("Admin actor id = ", admin_id_);
// Enable listening on port 8085 (client connections)
listen_port(8085);
@@ -65,7 +65,7 @@ public:
// Reset the print channeler.
print_channeler_.reset();
// Trigger the loading of the lua source.
rescan_lua_source(true);
}
@@ -75,15 +75,15 @@ public:
}
virtual void do_syntax_error(std::string_view error) override {
stdostream() << "Syntax error: " << error << std::endl;
util::dprint("Syntax error: ", error, "\n");
}
virtual void do_unknown_command(std::string_view name) override {
stdostream() << "Unknown command: " << name << std::endl;
util::dprint("Unknown command: ", name, "\n");
}
virtual void do_view_command() override {
stdostream() << master_->tangibles_near_debug_string(admin_id_, 1000);
util::dprint(master_->tangibles_near_debug_string(admin_id_, 1000));
}
virtual void do_moveto_command(int x, int y) override {
@@ -120,12 +120,12 @@ public:
virtual void do_luaprobe_command(std::string_view cmd) override {
master_->snapshot();
stdostream() << master_->probe_lua_expr(admin_id_, cmd);
util::dprint(master_->probe_lua_expr(admin_id_, cmd));
master_->rollback();
}
void delete_client(UniqueClient &client) {
stdostream() << "Client closed: actor id=" << client->actor_id_ << std::endl;
util::dprint("Client closed: actor id=", client->actor_id_);
master_->disconnected(client->actor_id_);
client.reset();
}
@@ -135,7 +135,7 @@ public:
sb->write_uint8(util::MSG_DIFF);
sb->write_uint32(0);
int64_t tw_1 = sb->total_writes();
//stdostream() << "Sending diffs to client " << client->actor_id_ << std::endl;
// util::dprint("Sending diffs to client ", client->actor_id_);
client->sync_->diff(client->actor_id_, full, master_.get(), sb);
int64_t tw_2 = sb->total_writes();
sb->overwrite_int32(tw_1, tw_2 - tw_1);
@@ -164,7 +164,7 @@ public:
delete_client(client);
return false;
}
//stdostream() << "Invoking: " << inv.debug_string() << std::endl;
// util::dprint("Invoking: ", inv.debug_string());
master_->invoke(inv);
client->channel_->out()->write_uint8(util::MSG_ACK);
client->channel_->out()->write_uint32(0);
@@ -198,13 +198,14 @@ public:
break;
}
case AccessKind::CHANNEL_PRINTS: {
// If there's nothing new in the printbuffer, this is very fast.
if (print_channeler_.channel(master_->get_printbuffer(admin_id_), retpk)) {
master_->invoke(print_channeler_.invocation(admin_id_));
}
break;
}
default: {
stdostream() << "Invalid event_access: " << int(kind) << std::endl;
util::dprint("Invalid event_access: ", int(kind));
}
}
}
@@ -246,7 +247,7 @@ public:
// the client model and the server synchronous model are identical.
client->sync_->create_login_actor();
clients_.emplace_back(client);
stdostream() << "New client: actor id=" << client->actor_id_ << std::endl;
util::dprint("New client: actor id=", client->actor_id_);
} else if (chan->port() == 8080) {
HttpChannel htchan;
htchan.channel_ = chan;