diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index 45ed6c0d8d93caced0ed0379906cc60a9a5f011f..03a2e4c672a35056e591a91a65c04a6d9491658c 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -190,68 +190,31 @@ namespace AutoTx /// Write a summary of loaded config + status to the log. /// </summary> private void StartupSummary() { - writeLogDebug("------ RoboSharp ------"); + var msg = "\n\n------ RoboSharp ------\n"; var roboDll = System.Reflection.Assembly.GetAssembly(typeof(RoboCommand)).Location; if (roboDll != null) { var versionInfo = FileVersionInfo.GetVersionInfo(roboDll); - writeLogDebug(" > DLL file: " + roboDll); - writeLogDebug(" > DLL description: " + versionInfo.Comments); - writeLogDebug(" > DLL version: " + versionInfo.FileVersion); - } - writeLogDebug(""); - - writeLogDebug("------ Loaded status flags ------"); - writeLogDebug("CurrentTransferSrc: " + _status.CurrentTransferSrc); - writeLogDebug("CurrentTargetTmp: " + _status.CurrentTargetTmp); - writeLogDebug("TransferInProgress: " + _status.TransferInProgress); - writeLogDebug("LastStorageNotification: " + - _status.LastStorageNotification.ToString("yyyy-MM-dd HH:mm:ss")); - writeLogDebug("LastAdminNotification: " + - _status.LastAdminNotification.ToString("yyyy-MM-dd HH:mm:ss")); - writeLogDebug(""); - - writeLogDebug("------ Loaded configuration settings ------"); - writeLogDebug("HostAlias: " + _config.HostAlias); - writeLogDebug("SourceDrive: " + _config.SourceDrive); - writeLogDebug("IncomingDirectory: " + _config.IncomingDirectory); - writeLogDebug("MarkerFile: " + _config.MarkerFile); - writeLogDebug("ManagedDirectory: " + _config.ManagedDirectory); - writeLogDebug("GracePeriod: " + _config.GracePeriod); - writeLogDebug("DestinationDirectory: " + _config.DestinationDirectory); - writeLogDebug("TmpTransferDir: " + _config.TmpTransferDir); - writeLogDebug("EnforceInheritedACLs: " + _config.EnforceInheritedACLs); - writeLogDebug("ServiceTimer: " + _config.ServiceTimer); - writeLogDebug("InterPacketGap: " + _config.InterPacketGap); - writeLogDebug("MaxCpuUsage: " + _config.MaxCpuUsage); - writeLogDebug("MinAvailableMemory: " + _config.MinAvailableMemory); - foreach (var processName in _config.BlacklistedProcesses) { - writeLogDebug("BlacklistedProcess: " + processName); + msg += " > DLL file: " + roboDll + "\n" + + " > DLL description: " + versionInfo.Comments + "\n" + + " > DLL version: " + versionInfo.FileVersion + "\n"; } - foreach (var driveToCheck in _config.SpaceMonitoring) { - writeLogDebug("Drive to check free space: " + driveToCheck.DriveName + - " (threshold: " + driveToCheck.SpaceThreshold + ")"); - } - writeLogDebug("StorageNotificationDelta: " + _config.StorageNotificationDelta); - writeLogDebug("AdminNotificationDelta: " + _config.AdminNotificationDelta); - if (string.IsNullOrEmpty(_config.SmtpHost)) { - writeLogDebug("SmtpHost: ====== Not configured, disabling notification emails! ======"); - } else { - writeLogDebug("SmtpHost: " + _config.SmtpHost); - writeLogDebug("EmailFrom: " + _config.EmailFrom); - writeLogDebug("AdminEmailAdress: " + _config.AdminEmailAdress); - writeLogDebug("AdminDebugEmailAdress: " + _config.AdminDebugEmailAdress); - } - writeLogDebug(""); + writeLogDebug(msg); - // finally some current information: - writeLogDebug("------ Current system parameters ------"); - writeLogDebug("Hostname: " + Environment.MachineName); - writeLogDebug("Free system memory: " + GetFreeMemory() + " MB"); + + msg = "\n\n------ Loaded status flags ------\n" + _status.Summary() + + "\n------ Loaded configuration settings ------\n" + _config.Summary(); + writeLogDebug(msg); + + + msg = "\n\n------ Current system parameters ------\n" + + "Hostname: " + Environment.MachineName + "\n" + + "Free system memory: " + GetFreeMemory() + " MB" + "\n"; foreach (var driveToCheck in _config.SpaceMonitoring) { - writeLogDebug("Free space on drive '" + driveToCheck.DriveName + "': " + - GetFreeDriveSpace(driveToCheck.DriveName)); + msg += "Free space on drive '" + driveToCheck.DriveName + "': " + + GetFreeDriveSpace(driveToCheck.DriveName) + "\n"; } - writeLogDebug(""); + writeLogDebug(msg); + writeLogDebug("------ Grace location status ------"); try { diff --git a/AutoTx/XmlWrapper/ServiceConfig.cs b/AutoTx/XmlWrapper/ServiceConfig.cs index 384bd52e06c4b3085ab3233171030130ffbcbd81..dd70309fcdf9f4cccbbf9869e1e590c55f5a93c8 100644 --- a/AutoTx/XmlWrapper/ServiceConfig.cs +++ b/AutoTx/XmlWrapper/ServiceConfig.cs @@ -181,5 +181,41 @@ namespace AutoTx.XmlWrapper c.ValidationWarnings += " - <DestinationDirectory> is not a UNC path!\n"; } + public string Summary() { + var msg = + "HostAlias: " + HostAlias + "\n" + + "SourceDrive: " + SourceDrive + "\n" + + "IncomingDirectory: " + IncomingDirectory + "\n" + + "MarkerFile: " + MarkerFile + "\n" + + "ManagedDirectory: " + ManagedDirectory + "\n" + + "GracePeriod: " + GracePeriod + "\n" + + "DestinationDirectory: " + DestinationDirectory + "\n" + + "TmpTransferDir: " + TmpTransferDir + "\n" + + "EnforceInheritedACLs: " + EnforceInheritedACLs + "\n" + + "ServiceTimer: " + ServiceTimer + "\n" + + "InterPacketGap: " + InterPacketGap + "\n" + + "MaxCpuUsage: " + MaxCpuUsage + "\n" + + "MinAvailableMemory: " + MinAvailableMemory + "\n"; + foreach (var processName in BlacklistedProcesses) { + msg += "BlacklistedProcess: " + processName + "\n"; + } + foreach (var driveToCheck in SpaceMonitoring) { + msg += "Drive to check free space: " + driveToCheck.DriveName + + " (threshold: " + driveToCheck.SpaceThreshold + ")" + "\n"; + } + if (string.IsNullOrEmpty(SmtpHost)) { + msg += "SmtpHost: ====== Not configured, disabling email! ======" + "\n"; + } else { + msg += + "SmtpHost: " + SmtpHost + "\n" + + "EmailFrom: " + EmailFrom + "\n" + + "AdminEmailAdress: " + AdminEmailAdress + "\n" + + "AdminDebugEmailAdress: " + AdminDebugEmailAdress + "\n" + + "StorageNotificationDelta: " + StorageNotificationDelta + "\n" + + "AdminNotificationDelta: " + AdminNotificationDelta + "\n"; + + } + return msg; + } } } \ No newline at end of file diff --git a/AutoTx/XmlWrapper/ServiceStatus.cs b/AutoTx/XmlWrapper/ServiceStatus.cs index de48e5cadc806b93cc11444389b3dd620b645ec2..25f4ed826441dde7647da25629f8375983abd2de 100644 --- a/AutoTx/XmlWrapper/ServiceStatus.cs +++ b/AutoTx/XmlWrapper/ServiceStatus.cs @@ -197,5 +197,19 @@ namespace AutoTx.XmlWrapper } } + + public string Summary() { + return + "CurrentTransferSrc: " + CurrentTransferSrc + "\n" + + "CurrentTargetTmp: " + CurrentTargetTmp + "\n" + + "TransferInProgress: " + TransferInProgress + "\n" + + "CurrentTransferSize: " + CurrentTransferSize + "\n" + + "LastStatusUpdate: " + + LastStatusUpdate.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + + "LastStorageNotification: " + + LastStorageNotification.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + + "LastAdminNotification: " + + LastAdminNotification.ToString("yyyy-MM-dd HH:mm:ss") + "\n"; + } } }