Minor tweaks to log file names

This commit is contained in:
Brett Hewitson 2021-12-19 17:12:25 +10:00
parent d49496b1ff
commit 851a0df6b8
4 changed files with 16 additions and 14 deletions

View file

@ -36,14 +36,14 @@ namespace ServerManagerTool.Lib
public bool Equals(BranchSnapshot x, BranchSnapshot y)
{
//Check whether the compared objects reference the same data.
if (Object.ReferenceEquals(x, y)) return true;
if (ReferenceEquals(x, y)) return true;
//Check whether any of the compared objects is null.
if (x is null || y is null)
return false;
//Check whether the snapshot' properties are equal.
return x.BranchName == y.BranchName;
return string.Equals(x.BranchName ?? string.Empty, y.BranchName ?? string.Empty, StringComparison.OrdinalIgnoreCase);
}
public int GetHashCode(BranchSnapshot snapshot)

View file

@ -1135,6 +1135,7 @@ namespace ServerManagerTool.Lib
LogProfileMessage("------------------------");
LogProfileMessage($"Server Manager version: {App.Instance.Version}");
LogProfileMessage($"Server branch: {GetBranchName(_profile.BranchName)}");
LogProfileMessage($"Profile Name: {_profile.ProfileName}");
// check if the server needs to be updated
var serverCacheLastUpdated = GetServerLatestTime(GetServerCacheTimeFile(_profile?.BranchName));
@ -2968,7 +2969,7 @@ namespace ServerManagerTool.Lib
var createdNew = false;
if (OutputLogs)
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}_{branch.BranchName}", GetBranchName(branch.BranchName));
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}_{GetBranchName(branch.BranchName)}", $"Update_{GetBranchName(branch.BranchName)}");
try
{
@ -2997,7 +2998,7 @@ namespace ServerManagerTool.Lib
if (ExitCode == EXITCODE_NORMALEXIT)
{
// get the profile associated with the branch
var profiles = _profiles.Keys.Where(p => p.EnableAutoUpdate && p.BranchName.Equals(branch.BranchName, StringComparison.OrdinalIgnoreCase));
var profiles = _profiles.Keys.Where(p => p.EnableAutoUpdate && string.Equals(p.BranchName, branch.BranchName, StringComparison.OrdinalIgnoreCase));
var profileExitCodes = new ConcurrentDictionary<ServerProfileSnapshot, int>();
if (Config.Default.AutoUpdate_ParallelUpdate)
@ -3085,7 +3086,7 @@ namespace ServerManagerTool.Lib
{
int exitCode = EXITCODE_NORMALEXIT;
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOBACKUP), LOGPREFIX_AUTOBACKUP, "AutoBackup");
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOBACKUP), LOGPREFIX_AUTOBACKUP, "Backup");
try
{
@ -3134,7 +3135,7 @@ namespace ServerManagerTool.Lib
{
int exitCode = EXITCODE_NORMALEXIT;
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOSHUTDOWN), LOGPREFIX_AUTOSHUTDOWN, "AutoShutdown");
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOSHUTDOWN), LOGPREFIX_AUTOSHUTDOWN, "Shutdown");
try
{
@ -3218,7 +3219,7 @@ namespace ServerManagerTool.Lib
Mutex mutex = null;
bool createdNew = false;
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), LOGPREFIX_AUTOUPDATE, "AutoUpdate");
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), LOGPREFIX_AUTOUPDATE, "Update");
try
{

View file

@ -36,14 +36,14 @@ namespace ServerManagerTool.Lib
public bool Equals(BranchSnapshot x, BranchSnapshot y)
{
//Check whether the compared objects reference the same data.
if (Object.ReferenceEquals(x, y)) return true;
if (ReferenceEquals(x, y)) return true;
//Check whether any of the compared objects is null.
if (x is null || y is null)
return false;
//Check whether the snapshot' properties are equal.
return x.BranchName == y.BranchName;
return string.Equals(x.BranchName ?? string.Empty, y.BranchName ?? string.Empty, StringComparison.OrdinalIgnoreCase);
}
public int GetHashCode(BranchSnapshot snapshot)

View file

@ -1083,6 +1083,7 @@ namespace ServerManagerTool.Lib
LogProfileMessage("------------------------");
LogProfileMessage($"Server Manager version: {App.Instance.Version}");
LogProfileMessage($"Server branch: {GetBranchName(_profile.BranchName)}");
LogProfileMessage($"Profile Name: {_profile.ProfileName}");
// check if the server needs to be updated
var serverCacheLastUpdated = GetServerLatestTime(GetServerCacheTimeFile(_profile?.BranchName));
@ -2810,7 +2811,7 @@ namespace ServerManagerTool.Lib
var createdNew = false;
if (OutputLogs)
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}_{branch.BranchName}", GetBranchName(branch.BranchName));
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}_{GetBranchName(branch.BranchName)}", $"Update_{GetBranchName(branch.BranchName)}");
try
{
@ -2839,7 +2840,7 @@ namespace ServerManagerTool.Lib
if (ExitCode == EXITCODE_NORMALEXIT)
{
// get the profile associated with the branch
var profiles = _profiles.Keys.Where(p => p.EnableAutoUpdate && p.BranchName.Equals(branch.BranchName, StringComparison.OrdinalIgnoreCase));
var profiles = _profiles.Keys.Where(p => p.EnableAutoUpdate && string.Equals(p.BranchName, branch.BranchName, StringComparison.OrdinalIgnoreCase));
var profileExitCodes = new ConcurrentDictionary<ServerProfileSnapshot, int>();
if (Config.Default.AutoUpdate_ParallelUpdate)
@ -2927,7 +2928,7 @@ namespace ServerManagerTool.Lib
{
int exitCode = EXITCODE_NORMALEXIT;
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOBACKUP), LOGPREFIX_AUTOBACKUP, "AutoBackup");
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOBACKUP), LOGPREFIX_AUTOBACKUP, "Backup");
try
{
@ -2976,7 +2977,7 @@ namespace ServerManagerTool.Lib
{
int exitCode = EXITCODE_NORMALEXIT;
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOSHUTDOWN), LOGPREFIX_AUTOSHUTDOWN, "AutoShutdown");
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOSHUTDOWN), LOGPREFIX_AUTOSHUTDOWN, "Shutdown");
try
{
@ -3060,7 +3061,7 @@ namespace ServerManagerTool.Lib
Mutex mutex = null;
bool createdNew = false;
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), LOGPREFIX_AUTOUPDATE, "AutoUpdate");
_loggerManager = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), LOGPREFIX_AUTOUPDATE, "Update");
try
{