Skip to content

Output and logging ​

When several tasks run together, their output can be hard to follow. Choose an output mode to identify the source of each line or keep each command's output together. Use silent separately to hide the command text Task logs.

Choose an output mode ​

What do you need?Mode
Live output without extra formattinginterleaved (default)
Live output labeled by taskprefixed
Each command's output in one blockgroup

Identify parallel output ​

Set output: prefixed at the root of the Taskfile:

yaml
version: '3'

output: prefixed

tasks:
  check:
    deps: [lint, test]

  lint:
    cmds:
      - echo 'Lint passed'

  test:
    cmds:
      - echo 'Tests passed'

Run task --silent check. The command output identifies each task:

text
[lint] Lint passed
[test] Tests passed

The lines may appear in either order because the tasks run concurrently. You can override the output mode for one invocation with task --output group check (or task -o group check).

Use a task's prefix to distinguish repeated calls with different inputs:

yaml
version: '3'

output: prefixed

tasks:
  default:
    deps:
      - task: check
        vars: { SERVICE: api }
      - task: check
        vars: { SERVICE: worker }

  check:
    prefix: 'check-{{.SERVICE}}'
    silent: true
    cmds:
      - echo 'Passed'

The output uses [check-api] and [check-worker] prefixes.

Group command output ​

Set output: group to buffer each command's stdout and stderr until that command finishes. Long-running commands do not provide live feedback in this mode. Groups are per command, so blocks from different tasks can still alternate between commands.

To show buffered output only when a command fails:

yaml
version: '3'

silent: true
output:
  group:
    error_only: true

tasks:
  passes: echo 'Everything passed'
  fails: echo 'Failure details' && exit 1

task passes prints nothing. task fails prints Failure details and the failure message. Hiding successful output does not change exit codes.

Hide command echoes ​

Use --silent (or -s) to hide the command text Task logs before execution. The command's own output remains visible:

yaml
version: '3'

tasks:
  greet:
    cmds:
      - echo 'Hello, World!'

task greet shows the command and its output. task --silent greet prints only Hello, World!.

To make this permanent for selected commands:

yaml
version: '3'

tasks:
  greet:
    cmds:
      - cmd: echo 'Hello, World!'
        silent: true

You can also set silent: true on a task for all its commands, or at the root of the Taskfile for all tasks.

To suppress a command's stdout, use shell redirection instead:

yaml
version: '3'

tasks:
  quiet:
    cmds:
      - echo 'This output is discarded' > /dev/null

Stderr remains visible unless you redirect it too. Silent mode is not a substitute for secret masking.

Make CI logs readable ​

Fold command logs ​

Use output.group.begin and end to add the markers a CI system uses for collapsible logs. For GitHub Actions:

yaml
version: '3'

output:
  group:
    begin: '::group::{{.TASK}}'
    end: '::endgroup::'

tasks:
  default:
    silent: true
    cmds:
      - echo 'Hello, World!'

Running task produces:

text
::group::default
Hello, World!
::endgroup::

These markers follow GitHub Actions' grouping format. Other providers, such as Azure Pipelines, use different markers.

Control colors ​

Task enables its colored output when CI=true, which most CI providers set automatically. Use FORCE_COLOR=1 to force colors or NO_COLOR=1 to disable them. Programs launched by Task may have their own color settings.

Surface failures ​

When GITHUB_ACTIONS=true, Task automatically emits an annotation when a task fails, so the workflow can surface the error:

text
::error title=Task 'build' failed::exit status 1

No Taskfile configuration is required for these annotations.

Related guide

To continue after a selected failure, use ignore_error. See Errors and cleanup for its scope and examples.