diff --git a/src/CodeRelease/CodeRelease/BLL/LinuxExecuteCommand.cs b/src/CodeRelease/CodeRelease/BLL/LinuxExecuteCommand.cs
index 403b2b0..a629d99 100644
--- a/src/CodeRelease/CodeRelease/BLL/LinuxExecuteCommand.cs
+++ b/src/CodeRelease/CodeRelease/BLL/LinuxExecuteCommand.cs
@@ -1,4 +1,11 @@
-using System.Diagnostics;
+using CodeRelease.Model;
+
+using Serilog;
+
+using System;
+using System.Diagnostics;
+
+using static System.Runtime.InteropServices.JavaScript.JSType;
namespace CodeRelease.BLL
{
@@ -32,6 +39,7 @@ namespace CodeRelease.BLL
// 绑定输出和错误数据接收事件
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
{
+ Log.Logger.Information("linux执行出错,命令{command},sender:{sender}Output:{e}", command, sender, e);
if (!string.IsNullOrEmpty(e.Data))
{
Console.WriteLine($"Output: {e.Data}");
@@ -41,6 +49,7 @@ namespace CodeRelease.BLL
process.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
{
+ Log.Logger.Information("linux执行出错,命令{command},sender:{sender}Output:{e}", command, sender, e);
if (!string.IsNullOrEmpty(e.Data))
{
Console.WriteLine($"Error: {e.Data}");
@@ -59,13 +68,14 @@ namespace CodeRelease.BLL
await process.WaitForExitAsync();
// 输出退出代码
- Console.WriteLine($"Process exited with code {process.ExitCode}");
+ //Console.WriteLine($"Process exited with code {process.ExitCode}");
+ Log.Logger.Information($"执行结束 {process.ExitCode}");
exitCode = process.ExitCode;
}
}
catch (Exception ex)
{
- Console.WriteLine($"Exception: {ex.Message}");
+ Log.Logger.Information($"执行出现异常结束 {ex.Message}");
}
return new { exitCode, outputDataReceived, errorDataReceived };
}
diff --git a/src/CodeRelease/CodeRelease/CodeRelease.csproj b/src/CodeRelease/CodeRelease/CodeRelease.csproj
index d9e21ad..eed5ec8 100644
--- a/src/CodeRelease/CodeRelease/CodeRelease.csproj
+++ b/src/CodeRelease/CodeRelease/CodeRelease.csproj
@@ -8,6 +8,12 @@
+
+
+
+
+
+
diff --git a/src/CodeRelease/CodeRelease/Controllers/PublishController.cs b/src/CodeRelease/CodeRelease/Controllers/PublishController.cs
index 21988ca..0166f8f 100644
--- a/src/CodeRelease/CodeRelease/Controllers/PublishController.cs
+++ b/src/CodeRelease/CodeRelease/Controllers/PublishController.cs
@@ -8,6 +8,8 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
+using Serilog;
+
using System;
@@ -17,7 +19,7 @@ namespace CodeRelease.Controllers
[Route("api/[controller]/[Action]")]
[ApiController]
- public class PublishController : ControllerBase
+ public class PublishController() : ControllerBase
{
[HttpGet]
[HttpPost]
@@ -42,6 +44,7 @@ namespace CodeRelease.Controllers
///
public async Task