Addtional logging tweaks

This commit is contained in:
Brett Hewitson 2021-12-20 13:23:25 +10:00
parent 45be8adfb2
commit 59bcade7d2
2 changed files with 28 additions and 24 deletions

View file

@ -541,6 +541,7 @@ namespace ServerManagerTool.Lib
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting server update."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting server update.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server branch: {ServerApp.GetBranchName(branch?.BranchName)}."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server branch: {ServerApp.GetBranchName(branch?.BranchName)}.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Profile name: {this.ProfileSnapshot.ProfileName}.");
// create the branch arguments // create the branch arguments
var steamCmdInstallServerBetaArgs = new StringBuilder(); var steamCmdInstallServerBetaArgs = new StringBuilder();
@ -578,8 +579,8 @@ namespace ServerManagerTool.Lib
} }
} }
progressCallback?.Invoke(0, "\r\n"); progressCallback?.Invoke(0, "", true);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Updating server from steam.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Updating server from steam.");
downloadSuccessful = !Config.Default.SteamCmdRedirectOutput; downloadSuccessful = !Config.Default.SteamCmdRedirectOutput;
DataReceivedEventHandler serverOutputHandler = (s, e) => DataReceivedEventHandler serverOutputHandler = (s, e) =>
@ -619,15 +620,14 @@ namespace ServerManagerTool.Lib
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server version: {this.Version}\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server version: {this.Version}\r\n");
} }
progressCallback?.Invoke(0, "\r\n");
} }
else else
{ {
success = false; success = false;
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Failed server update."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Failed server update.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Check steamcmd logs for more information why the server update failed.\r\n");
if (Config.Default.SteamCmdRedirectOutput) if (Config.Default.SteamCmdRedirectOutput)
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the server update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the server update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n");
@ -685,14 +685,12 @@ namespace ServerManagerTool.Lib
downloadSuccessful = false; downloadSuccessful = false;
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Started processing mod {index + 1} of {modIdList.Count}."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Started processing mod {index + 1} of {modIdList.Count}.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod {modId}.");
// check if the steam information was downloaded // check if the steam information was downloaded
var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase)); var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase));
modTitle = $"{modId} - {modDetail?.title ?? "<unknown>"}"; modTitle = $"{modId} - {modDetail?.title ?? "<unknown>"}";
if (modDetail != null) progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod {modTitle}.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} {modDetail.title}.\r\n");
var modCachePath = ModUtils.GetModCachePath(modId, this.ProfileSnapshot.SotFEnabled); var modCachePath = ModUtils.GetModCachePath(modId, this.ProfileSnapshot.SotFEnabled);
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, this.ProfileSnapshot.SotFEnabled); var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, this.ProfileSnapshot.SotFEnabled);
@ -771,7 +769,7 @@ namespace ServerManagerTool.Lib
} }
}; };
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting mod download.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting mod download.");
var steamCmdArgs = string.Empty; var steamCmdArgs = string.Empty;
var steamCmdRemoveQuit = CommonConfig.Default.SteamCmdRemoveQuit && !Config.Default.SteamCmdRedirectOutput; var steamCmdRemoveQuit = CommonConfig.Default.SteamCmdRemoveQuit && !Config.Default.SteamCmdRedirectOutput;
@ -804,7 +802,7 @@ namespace ServerManagerTool.Lib
// update the last updated file with the steam updated time. // update the last updated file with the steam updated time.
File.WriteAllText(cacheTimeFile, steamLastUpdated); File.WriteAllText(cacheTimeFile, steamLastUpdated);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod Cache version: {steamLastUpdated}\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod Cache version: {steamLastUpdated}");
} }
} }
else else
@ -812,7 +810,8 @@ namespace ServerManagerTool.Lib
modSuccess = false; modSuccess = false;
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Mod download failed."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Mod download failed.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Check steamcmd logs for more information why the mod update failed.\r\n");
if (Config.Default.SteamCmdRedirectOutput) if (Config.Default.SteamCmdRedirectOutput)
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the mod update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the mod update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n");
@ -865,7 +864,7 @@ namespace ServerManagerTool.Lib
count++; count++;
progressCallback?.Invoke(0, ".", count % DIRECTORIES_PER_LINE == 0); progressCallback?.Invoke(0, ".", count % DIRECTORIES_PER_LINE == 0);
}), cancellationToken); }), cancellationToken);
progressCallback?.Invoke(0, "\r\n"); progressCallback?.Invoke(0, "", true);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Finished mod copy."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Finished mod copy.");
var modLastUpdated = ModUtils.GetModLatestTime(modTimeFile); var modLastUpdated = ModUtils.GetModLatestTime(modTimeFile);

View file

@ -540,6 +540,7 @@ namespace ServerManagerTool.Lib
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting server update."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting server update.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server branch: {ServerApp.GetBranchName(branch?.BranchName)}."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server branch: {ServerApp.GetBranchName(branch?.BranchName)}.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Profile name: {this.ProfileSnapshot.ProfileName}.");
// create the branch arguments // create the branch arguments
var steamCmdInstallServerBetaArgs = new StringBuilder(); var steamCmdInstallServerBetaArgs = new StringBuilder();
@ -577,8 +578,8 @@ namespace ServerManagerTool.Lib
} }
} }
progressCallback?.Invoke(0, "\r\n"); progressCallback?.Invoke(0, "", true);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Updating server from steam.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Updating server from steam.");
downloadSuccessful = !Config.Default.SteamCmdRedirectOutput; downloadSuccessful = !Config.Default.SteamCmdRedirectOutput;
DataReceivedEventHandler serverOutputHandler = (s, e) => DataReceivedEventHandler serverOutputHandler = (s, e) =>
@ -611,16 +612,21 @@ namespace ServerManagerTool.Lib
gotNewVersion = ServerApp.HasNewServerVersion(this.ProfileSnapshot.InstallDirectory, startTime); gotNewVersion = ServerApp.HasNewServerVersion(this.ProfileSnapshot.InstallDirectory, startTime);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} New server version - {gotNewVersion.ToString().ToUpperInvariant()}."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} New server version - {gotNewVersion.ToString().ToUpperInvariant()}.");
}
progressCallback?.Invoke(0, "\r\n"); // update the version number of the server.
var versionFile = Path.Combine(this.ProfileSnapshot.InstallDirectory, Config.Default.ServerBinaryRelativePath, Config.Default.ServerExeFile);
this.Version = ServerApp.GetServerVersion(versionFile);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server version: {this.Version}\r\n");
}
} }
else else
{ {
success = false; success = false;
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Failed server update."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Failed server update.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ****************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Check steamcmd logs for more information why the server update failed.\r\n");
if (Config.Default.SteamCmdRedirectOutput) if (Config.Default.SteamCmdRedirectOutput)
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the server update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the server update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n");
@ -677,14 +683,12 @@ namespace ServerManagerTool.Lib
downloadSuccessful = false; downloadSuccessful = false;
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Started processing mod {index + 1} of {modIdList.Count}."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Started processing mod {index + 1} of {modIdList.Count}.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod {modId}.");
// check if the steam information was downloaded // check if the steam information was downloaded
var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase)); var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase));
modTitle = $"{modId} - {modDetail?.title ?? "<unknown>"}"; modTitle = $"{modId} - {modDetail?.title ?? "<unknown>"}";
if (modDetail != null) progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod {modTitle}.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} {modDetail.title}.\r\n");
var modCachePath = ModUtils.GetModCachePath(modId); var modCachePath = ModUtils.GetModCachePath(modId);
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId); var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId);
@ -763,7 +767,7 @@ namespace ServerManagerTool.Lib
} }
}; };
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting mod download.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting mod download.");
var steamCmdArgs = string.Empty; var steamCmdArgs = string.Empty;
var steamCmdRemoveQuit = CommonConfig.Default.SteamCmdRemoveQuit && !Config.Default.SteamCmdRedirectOutput; var steamCmdRemoveQuit = CommonConfig.Default.SteamCmdRemoveQuit && !Config.Default.SteamCmdRedirectOutput;
@ -796,7 +800,7 @@ namespace ServerManagerTool.Lib
// update the last updated file with the steam updated time. // update the last updated file with the steam updated time.
File.WriteAllText(cacheTimeFile, steamLastUpdated); File.WriteAllText(cacheTimeFile, steamLastUpdated);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod Cache version: {steamLastUpdated}\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod Cache version: {steamLastUpdated}");
} }
} }
else else
@ -804,7 +808,8 @@ namespace ServerManagerTool.Lib
modSuccess = false; modSuccess = false;
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Mod download failed."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Mod download failed.");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************");
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Check steamcmd logs for more information why the mod update failed.\r\n");
if (Config.Default.SteamCmdRedirectOutput) if (Config.Default.SteamCmdRedirectOutput)
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the mod update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n"); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} If the mod update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the settings window.\r\n");
@ -857,7 +862,7 @@ namespace ServerManagerTool.Lib
count++; count++;
progressCallback?.Invoke(0, ".", count % DIRECTORIES_PER_LINE == 0); progressCallback?.Invoke(0, ".", count % DIRECTORIES_PER_LINE == 0);
}), cancellationToken); }), cancellationToken);
progressCallback?.Invoke(0, "\r\n"); progressCallback?.Invoke(0, "", true);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Finished mod copy."); progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Finished mod copy.");
var modLastUpdated = ModUtils.GetModLatestTime(modTimeFile); var modLastUpdated = ModUtils.GetModLatestTime(modTimeFile);