-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Azure DevOps logging commands (#43)
+semver: feature
- Loading branch information
Showing
4 changed files
with
124 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/AzureDevOpsTraceLoggerAdapter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
namespace Capgemini.PowerApps.PackageDeployerTemplate.Adapters | ||
{ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Xrm.Tooling.PackageDeployment.CrmPackageExtentionBase; | ||
|
||
/// <summary> | ||
/// An adapter class from <see cref="TraceLogger"/> to <see cref="ILogger"/> for use on Azure DevOps. | ||
/// </summary> | ||
[ExcludeFromCodeCoverage] | ||
public class AzureDevOpsTraceLoggerAdapter : TraceLoggerAdapter | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="AzureDevOpsTraceLoggerAdapter"/> class. | ||
/// </summary> | ||
/// <param name="traceLogger">The <see cref="TraceLogger"/>.</param> | ||
public AzureDevOpsTraceLoggerAdapter(TraceLogger traceLogger) | ||
: base(traceLogger) | ||
{ | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override string GetPrefix(LogLevel logLevel) | ||
{ | ||
switch (logLevel) | ||
{ | ||
case LogLevel.Warning: | ||
return "##[task.logissue type=warning]"; | ||
case LogLevel.Error: | ||
case LogLevel.Critical: | ||
return "##[task.logissue type=error]"; | ||
default: | ||
return string.Empty; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters