From 92f7f60b4adf56deed3b895dcd467f577ca2e6ec Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 10 Aug 2018 11:10:43 -0400 Subject: [PATCH] Add logging to ProcessExecutor --- .../Core/ProcessExecutor.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Core/ProcessExecutor.cs b/src/Tgstation.Server.Host/Core/ProcessExecutor.cs index d42474b5c4..d5eee0b505 100644 --- a/src/Tgstation.Server.Host/Core/ProcessExecutor.cs +++ b/src/Tgstation.Server.Host/Core/ProcessExecutor.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Extensions.Logging; +using System; using System.Diagnostics; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,11 @@ namespace Tgstation.Server.Host.Core /// sealed class ProcessExecutor : IProcessExecutor { + /// + /// The for the + /// + readonly ILogger logger; + /// /// Create a resulting in the exit code of a given /// @@ -21,9 +27,19 @@ namespace Tgstation.Server.Host.Core return tcs.Task; } + /// + /// Construct a + /// + /// The value of + public ProcessExecutor(ILogger logger) + { + this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); + } + /// public IProcess GetProcess(int id) { + logger.LogDebug("Attaching to process {0}...", id); var handle = System.Diagnostics.Process.GetProcessById(id); try { @@ -39,6 +55,7 @@ namespace Tgstation.Server.Host.Core /// public IProcess LaunchProcess(string fileName, string workingDirectory, string arguments, bool readOutput, bool readError) { + logger.LogDebug("Launching process in {0}: {1} {2}", workingDirectory, fileName, arguments); var handle = new System.Diagnostics.Process(); try {