Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit 8c84e70

Browse files
author
Dankrushen
authored
Merge pull request #247 from ServerMod/log-port
Add the server port to the log file names
2 parents e152d60 + 28f929a commit 8c84e70

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

MultiAdmin/Server.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public class Server
2828

2929
public readonly string serverId;
3030
public readonly string configLocation;
31-
public readonly uint? port;
31+
private readonly uint? port;
3232
public readonly string[] args;
3333
public readonly string serverDir;
3434
public readonly string logDir;
3535

36+
public uint Port => port ?? ServerConfig.Port.Value;
37+
3638
private DateTime initStopTimeoutTime;
3739
private DateTime initRestartTimeoutTime;
3840

@@ -129,7 +131,7 @@ private set
129131
// Update related variables
130132
LogDirFile = string.IsNullOrEmpty(value) || string.IsNullOrEmpty(logDir)
131133
? null
132-
: $"{Path.Combine(logDir, value)}_{{0}}_output_log.txt";
134+
: $"{Path.Combine(logDir, value)}_{{0}}_log_{Port}.txt";
133135

134136
lock (this)
135137
{
@@ -309,7 +311,7 @@ public void StartServer(bool restartOnCrash = true)
309311
"-nodedicateddelete",
310312
$"-id{Process.GetCurrentProcess().Id}",
311313
$"-console{consoleSocket.Port}",
312-
$"-port{port ?? ServerConfig.Port.Value}"
314+
$"-port{Port}"
313315
};
314316

315317
if (string.IsNullOrEmpty(ScpLogFile) || ServerConfig.NoLog.Value)

0 commit comments

Comments
 (0)