diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-02-09 17:51:57 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-02-09 17:51:57 -0600 |
| commit | 83bfe9e3b2999c4c34becd4868f7195b1cc84b1c (patch) | |
| tree | 3bde8f76e15c24f2fe336583cb4ca7c730abec7b /src/slskd/Integrations/Scripts/ScriptService.cs | |
| parent | ddd0dbff4604d484fb058197539879208b281a3e (diff) | |
| download | slskd-83bfe9e3b2999c4c34becd4868f7195b1cc84b1c.tar.gz | |
log process id
Diffstat (limited to 'src/slskd/Integrations/Scripts/ScriptService.cs')
| -rw-r--r-- | src/slskd/Integrations/Scripts/ScriptService.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/slskd/Integrations/Scripts/ScriptService.cs b/src/slskd/Integrations/Scripts/ScriptService.cs index d4eb0bb1..2c1bc66d 100644 --- a/src/slskd/Integrations/Scripts/ScriptService.cs +++ b/src/slskd/Integrations/Scripts/ScriptService.cs @@ -65,6 +65,7 @@ public class ScriptService _ = Task.Run(() => { Process process = default; + var processId = Guid.NewGuid(); try { @@ -93,7 +94,7 @@ public class ScriptService args = parts.Length > 1 ? parts[1] : null; } - Log.Debug("Running script '{Script}': {Run}", script.Key, run); + Log.Debug("Running script '{Script}': \"{Executable}\" {Args} (id: {ProcessId})", script.Key, executable, args, processId); var sw = Stopwatch.StartNew(); process = new Process() @@ -129,11 +130,11 @@ public class ScriptService var result = process.StandardOutput.ReadToEnd(); var resultAsLines = result.Split(["\r\n", "\r", "\n"], StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); - Log.Debug("Script '{Script}' ran successfully in {Duration}ms; output: {Output}", script.Key, sw.ElapsedMilliseconds, resultAsLines); + Log.Debug("Script '{Script}' ran successfully in {Duration}ms; output: {Output} (id: {ProcessId})", script.Key, sw.ElapsedMilliseconds, resultAsLines, processId); } catch (Exception ex) { - Log.Warning(ex, "Failed to run script '{Script}' for event type {Event}: {Message}", script.Key, data.Type, ex.Message); + Log.Warning(ex, "Failed to run script '{Script}' for event type {Event}: {Message} (id: {ProcessId})", script.Key, data.Type, ex.Message, processId); } finally { @@ -144,7 +145,7 @@ public class ScriptService } catch (Exception ex) { - Log.Warning(ex, "Failed to clean up process started from script '{Script}' for event type {Event}: {Message}", script.Key, data.Type, ex.Message); + Log.Warning(ex, "Failed to clean up process started from script '{Script}' for event type {Event}: {Message} (id: {ProcessId})", script.Key, data.Type, ex.Message, processId); } } }); |
