mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +00:00
Extract to method
This commit is contained in:
@@ -1402,15 +1402,14 @@ namespace GitHub.Runner.Worker
|
|||||||
|
|
||||||
public void Error(string format, params Object[] args)
|
public void Error(string format, params Object[] args)
|
||||||
{
|
{
|
||||||
_executionContext.Global.EnvironmentVariables.TryGetValue(Constants.Runner.Features.LogTemplateErrorsAsDebugMessage, out var logErrorsAsDebug);
|
|
||||||
if (StringUtil.ConvertToBoolean(logErrorsAsDebug, defaultValue: false))
|
if (logTemplateErrorsAsDebugMessage())
|
||||||
{
|
{
|
||||||
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, format, args));
|
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, format, args));
|
||||||
}
|
}
|
||||||
else _executionContext.Error(string.Format(CultureInfo.CurrentCulture, format, args));
|
else _executionContext.Error(string.Format(CultureInfo.CurrentCulture, format, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Info(string format, params Object[] args)
|
public void Info(string format, params Object[] args)
|
||||||
{
|
{
|
||||||
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, $"{format}", args));
|
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, $"{format}", args));
|
||||||
@@ -1421,6 +1420,13 @@ namespace GitHub.Runner.Worker
|
|||||||
// todo: switch to verbose?
|
// todo: switch to verbose?
|
||||||
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, $"{format}", args));
|
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, $"{format}", args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool logTemplateErrorsAsDebugMessage()
|
||||||
|
{
|
||||||
|
_executionContext.Global.EnvironmentVariables.TryGetValue(Constants.Runner.Features.LogTemplateErrorsAsDebugMessage, out var logErrorsAsDebug);
|
||||||
|
return StringUtil.ConvertToBoolean(logErrorsAsDebug, defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class WellKnownTags
|
public static class WellKnownTags
|
||||||
@@ -1432,4 +1438,5 @@ namespace GitHub.Runner.Worker
|
|||||||
public static readonly string Notice = "##[notice]";
|
public static readonly string Notice = "##[notice]";
|
||||||
public static readonly string Debug = "##[debug]";
|
public static readonly string Debug = "##[debug]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user