在 Azure Devops Release 管道日志中,是否有选项可以将字体文本颜色更改为红色以表示例外。
这是改变颜色的方法。
echo "##[group]Beginning of a group"
echo "##[warning]Warning message"
echo "##[error]Error message"
echo "##[section]Start of a section"
echo "##[debug]Debug text"
echo "##[command]Command-line being run"
echo "##[endgroup]"
是的,MS Azure Pipelines 有多种选项可以向日志添加着色和其他精美的显示选项。记录于此处。
有多种格式化文本的日志命令。但这里没有办法自由选择。在颜色格式方面,您可以使用这些
- script: |
echo "##[section]This would be green"
echo "##[command]And this blue"
displayName: 'Color formatting'
如果您不介意方括号中的前缀,您可以使用这些:
- script: |
echo "##[warning]Warning message"
echo "##[error]Error message"
echo "##[debug]Debug text"
displayName: 'Color formatting'
还有一种分组消息的方法。当您要打印较长的文本时,它非常有用。然后您可以折叠/展开该消息
- script: |
echo "##[group]Beginning of a group"
echo "##[warning]Warning message"
echo "##[error]Error message"
echo "##[section]Start of a section"
echo "##[debug]Debug text"
echo "##[command]Command-line being run"
echo "##[endgroup]"
displayName: 'Grouping'
您可以在文档
中找到所有这些信息