diff --git a/nuke/Build.Github.cs b/nuke/Build.Github.cs index 53d2b52..6aebf1a 100644 --- a/nuke/Build.Github.cs +++ b/nuke/Build.Github.cs @@ -9,6 +9,8 @@ using Octokit; +using Serilog; + using System; using System.IO; using System.Linq; @@ -35,10 +37,10 @@ internal partial class Build .OnlyWhenDynamic(() => GitVersion.BranchName.Equals("main") || GitVersion.BranchName.Equals("origin/main")) .Executes(async () => { - if (string.IsNullOrWhiteSpace(GhAccessToken)) ControlFlow.Fail($"{nameof(GhAccessToken)} is null"); - Logger.Info("Release to github..."); + if (string.IsNullOrWhiteSpace(GhAccessToken)) Assert.Fail($"{nameof(GhAccessToken)} is null"); + Log.Information("Release to github..."); await PublishAndUploadToGitHubRelease(GitVersion); - Logger.Info("Release to github finished."); + Log.Information("Release to github finished."); }); private async Task PublishAndUploadToGitHubRelease(GitVersion git) @@ -73,7 +75,7 @@ private async Task PublishAndUploadToGitHubRelease(GitVersion git) } catch (Exception e) { - Logger.Error(e); + Log.Error(e, null); } // await GitHubTasks.GitHubClient // .Repository.Release diff --git a/nuke/Build.cs b/nuke/Build.cs index a54fad4..92c39b5 100644 --- a/nuke/Build.cs +++ b/nuke/Build.cs @@ -10,6 +10,8 @@ using Nuke.Common.Tools.MSBuild; using Nuke.Common.Utilities.Collections; +using Serilog; + using System; using System.IO; using System.IO.Compression; @@ -130,7 +132,7 @@ protected override void OnBuildInitialized() .DependsOn(Publish) .Executes(() => { - Logger.Info("Delete output.."); + Log.Information("Delete output.."); PublishDirectory.GlobDirectories("**/output").ForEach(DeleteDirectory); }); @@ -164,9 +166,9 @@ protected override void OnBuildInitialized() .Executes(() => { if (HostType != HostType.AzurePipelines) return; - Logger.Info("Upload artifacts to azure..."); + Log.Information("Upload artifacts to azure..."); AzurePipelines .UploadArtifacts("artifacts", "artifacts", ArtifactsDirectory); - Logger.Info("Upload artifacts to azure finished."); + Log.Information("Upload artifacts to azure finished."); }); } \ No newline at end of file