From 81c0f9a569eaee58a28ca521b15ab397c03a4890 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 20 Apr 2021 08:13:56 +0300 Subject: [PATCH] Better logs with OOC logging, [IC] and [OOC] tags (#519) * Add OOC logging to the .log files, making them infinitely more precious to GMs especially of ambitious multi-area RPs Add [IC] and [OOC] tags to distinguish between the types of msg * minor wording change for .log top line to make it clearer that it's the server address and not the user address Co-authored-by: oldmud0 --- src/courtroom.cpp | 5 +++++ src/packet_distribution.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index fd0e1ca..9a6fd08 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1647,6 +1647,11 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, ui_server_chatlog->append_chatmessage(p_name, p_message, color); + + if (ao_app->get_auto_logging_enabled() && !ao_app->log_filename.isEmpty()) { + QString full = "[OOC][" + QDateTime::currentDateTime().toUTC().toString() + "] " + p_name + ": " + p_message; + ao_app->append_to_file(full, ao_app->log_filename, true); + } } void Courtroom::on_authentication_state_received(int p_state) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index cf51002..dc76ec1 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -308,7 +308,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) this->log_filename = QDateTime::currentDateTime().toUTC().toString( "'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + "/'yyyy-MM-dd hh-mm-ss t'.log'"); - this->write_to_file("Joined server " + server_name + " on address " + + this->write_to_file("Joined server " + server_name + " hosted on address " + server_address + " on " + QDateTime::currentDateTime().toUTC().toString(), log_filename, true);