summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-18 19:50:29 +0200
committertycho <work.tycho@gmail.com>2015-05-20 02:50:04 +0200
commit7c196ffde665a673e6e864754219b0e2c74001ac (patch)
tree5e719bbb0efd9502042b9c08db09c8031f603941
parentMerge pull request #2076 from mc-server/Cert-disable (diff)
downloadcuberite-7c196ffde665a673e6e864754219b0e2c74001ac.tar
cuberite-7c196ffde665a673e6e864754219b0e2c74001ac.tar.gz
cuberite-7c196ffde665a673e6e864754219b0e2c74001ac.tar.bz2
cuberite-7c196ffde665a673e6e864754219b0e2c74001ac.tar.lz
cuberite-7c196ffde665a673e6e864754219b0e2c74001ac.tar.xz
cuberite-7c196ffde665a673e6e864754219b0e2c74001ac.tar.zst
cuberite-7c196ffde665a673e6e864754219b0e2c74001ac.zip
-rw-r--r--src/main.cpp43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8a237b8ee..fdc3c7872 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -374,6 +374,12 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
TCLAP::MultiArg<int> portsArg("p", "port", "The port number the server should listen to", false, "port", cmd);
+ TCLAP::SwitchArg commLogArg("", "log-comm", "Log server client communications to file", cmd);
+
+ TCLAP::SwitchArg commLogInArg("", "log-comm-in", "Log inbound server client communications to file", cmd);
+
+ TCLAP::SwitchArg commLogOutArg("", "log-comm-out", "Log outbound server client communications to file", cmd);
+
cmd.parse(argc, argv);
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
@@ -396,6 +402,17 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
}
}
+ if (commLogArg.getValue())
+ {
+ g_ShouldLogCommIn = true;
+ g_ShouldLogCommOut = true;
+ }
+ else
+ {
+ g_ShouldLogCommIn = commLogInArg.getValue();
+ g_ShouldLogCommOut = commLogOutArg.getValue();
+ }
+
repo->SetReadOnly();
return repo;
@@ -473,31 +490,7 @@ int main(int argc, char **argv)
for (int i = 0; i < argc; i++)
{
AString Arg(argv[i]);
- if (
- (NoCaseCompare(Arg, "/commlog") == 0) ||
- (NoCaseCompare(Arg, "/logcomm") == 0)
- )
- {
- g_ShouldLogCommIn = true;
- g_ShouldLogCommOut = true;
- }
- else if (
- (NoCaseCompare(Arg, "/commlogin") == 0) ||
- (NoCaseCompare(Arg, "/comminlog") == 0) ||
- (NoCaseCompare(Arg, "/logcommin") == 0)
- )
- {
- g_ShouldLogCommIn = true;
- }
- else if (
- (NoCaseCompare(Arg, "/commlogout") == 0) ||
- (NoCaseCompare(Arg, "/commoutlog") == 0) ||
- (NoCaseCompare(Arg, "/logcommout") == 0)
- )
- {
- g_ShouldLogCommOut = true;
- }
- else if (NoCaseCompare(Arg, "nooutbuf") == 0)
+ if (NoCaseCompare(Arg, "nooutbuf") == 0)
{
setvbuf(stdout, nullptr, _IONBF, 0);
}