mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
Add configuration options to enable database logging
This commit is contained in:
parent
2896f05823
commit
cd69bc8f9d
4 changed files with 35 additions and 3 deletions
|
|
@ -79,7 +79,7 @@ password=foobar
|
|||
|
||||
[rooms]
|
||||
|
||||
; A servtrice server can expose to the users different "rooms" to chat and create games. Rooms can be defined
|
||||
; A servatrice server can expose to the users different "rooms" to chat and create games. Rooms can be defined
|
||||
; with two different methods:
|
||||
; config: rooms are defined in this configuration (see the following example)
|
||||
; sql: rooms are defined in the "rooms" table of the database
|
||||
|
|
@ -144,6 +144,24 @@ max_message_count_per_interval=10
|
|||
max_games_per_user=5
|
||||
|
||||
|
||||
[logging]
|
||||
|
||||
; Servatrice can log user messages to the database table cockatrice_log.
|
||||
; These messages can come from different sources; each source can be enabled separately.
|
||||
|
||||
; Log user messages inside chat rooms
|
||||
log_user_msg_room=false
|
||||
|
||||
; Log user messages inside games
|
||||
log_user_msg_game=false
|
||||
|
||||
; Log user messages in private chats
|
||||
log_user_msg_chat=false
|
||||
|
||||
; Log user messages coming from other servers in the network
|
||||
log_user_msg_isl=false
|
||||
|
||||
|
||||
; EXPERIMENTAL - NOT WORKING YET
|
||||
; The following settings are relative to the server network functionality, that is not yet complete.
|
||||
; Avoid enabling it unless you are willing to test it and help its development.
|
||||
|
|
|
|||
|
|
@ -546,15 +546,29 @@ void Servatrice_DatabaseInterface::logMessage(const int senderId, const QString
|
|||
switch(targetType)
|
||||
{
|
||||
case MessageTargetRoom:
|
||||
if(!settingsCache->value("logging/log_user_msg_room", 0).toBool())
|
||||
return;
|
||||
targetTypeString = "room";
|
||||
break;
|
||||
case MessageTargetGame:
|
||||
if(!settingsCache->value("logging/log_user_msg_game", 0).toBool())
|
||||
return;
|
||||
targetTypeString = "game";
|
||||
break;
|
||||
case MessageTargetChat:
|
||||
if(!settingsCache->value("logging/log_user_msg_chat", 0).toBool())
|
||||
return;
|
||||
targetTypeString = "chat";
|
||||
break;
|
||||
case MessageTargetIslRoom:
|
||||
if(!settingsCache->value("logging/log_user_msg_isl", 0).toBool())
|
||||
return;
|
||||
targetTypeString = "room";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
query.prepare("insert into " + server->getDbPrefix() + "_log (log_time, sender_id, sender_name, sender_ip, log_message, target_type, target_id, target_name) values (now(), :sender_id, :sender_name, :sender_ip, :log_message, :target_type, :target_id, :target_name)");
|
||||
query.bindValue(":sender_id", senderId);
|
||||
query.bindValue(":sender_name", senderName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue