Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configuration to not log commands #10537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/src/mindustry/core/NetClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.zip.*;

import static mindustry.Vars.*;
import static mindustry.net.Administration.Config.logCommands;

public class NetClient implements ApplicationListener{
private static final long entitySnapshotTimeout = 1000 * 20;
Expand Down Expand Up @@ -276,7 +277,7 @@ public static void sendChatMessage(Player player, String message){
Events.fire(new PlayerChatEvent(player, message));

//log commands before they are handled
if(message.startsWith(netServer.clientCommands.getPrefix())){
if(message.startsWith(netServer.clientCommands.getPrefix()) && logCommands.bool()){
//log with brackets
Log.info("<&fi@: @&fr>", "&lk" + player.plainName(), "&lw" + message);
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/mindustry/net/Administration.java
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ public static class Config{
snapshotInterval = new Config("snapshotInterval", "Client entity snapshot interval in ms.", 200),
autoPause = new Config("autoPause", "Whether the game should pause when nobody is online.", false),
roundExtraTime = new Config("roundExtraTime", "Time before loading a new map after the gameover, in seconds.", 12),
maxLogLength = new Config("maxLogLength", "The Maximum log file size, in bytes.", 1024 * 1024 * 5);
maxLogLength = new Config("maxLogLength", "The Maximum log file size, in bytes.", 1024 * 1024 * 5),
logCommands = new Config("logCommands", "Whether commands should be logged.", true);

public final Object defaultValue;
public final String name, key, description;
Expand Down