<commit_before># Managing Log Output

Buildkite uses our open-source [terminal Golang library](https://github.com/buildkite/terminal) to provide you with the best possible terminal rendering experience for your build logs, including ANSI terminal emulation to ensure spinners, progress bars, colors and emojis are rendered beautifully.

<%= toc %>

## Collapsing Output

You can group and collapse your build output by echoing `--- [group name]` in your build output.

```bash
echo "--- A section of the build"
```

If you want to have the group open by default, use `+++` instead of `---`:

```bash
echo "+++ A section of the build"
```

If you'd like to open the previously defined group, use `^^^ +++`. This is useful if a command within a group fails, and you'd like to have the group already open when you view the log.

```bash
echo "--- Bundling"
bundle
if [[ $? -ne 0 ]]; then
  echo "^^^ +++"
  echo "Bundler failed, oh no!!"
fi
```

You can even include colors and emojis!

```bash
echo -e "--- Running \033[33mspecs\033[0m \:cow:\:bell:"
```

<%= image("collapsing_example.png", size: '261x127', alt: 'Screenshot of colored, emoji build output') %>

## Log output limits

If your build output exceeds 1MB then we'll only show the last 1MB of it in the rendered terminal output on your build page. In addition, your log file must not exceed 100MB else it may fail to upload.

If your log exceeds 1MB then we highly recommend reconfiguring your build tools to filter out unnecessary lines. Sometimes this isn't always possible, so you can use the below techniques to store and filter your log.

## Storing the original log

One method for storing the original log is the Unix `tee` command. It allows you to store the output stream of a command to a file and passing it straight through unchanged to the next command.
<commit_msg>Properly escape emoji in code block<commit_after># Managing Log Output

Buildkite uses our open-source [terminal Golang library](https://github.com/buildkite/terminal) to provide you with the best possible terminal rendering experience for your build logs, including ANSI terminal emulation to ensure spinners, progress bars, colors and emojis are rendered beautifully.

<%= toc %>

## Collapsing Output

You can group and collapse your build output by echoing `--- [group name]` in your build output.

```bash
echo "--- A section of the build"
```

If you want to have the group open by default, use `+++` instead of `---`:

```bash
echo "+++ A section of the build"
```

If you'd like to open the previously defined group, use `^^^ +++`. This is useful if a command within a group fails, and you'd like to have the group already open when you view the log.

```bash
echo "--- Bundling"
bundle
if [[ $? -ne 0 ]]; then
  echo "^^^ +++"
  echo "Bundler failed, oh no!!"
fi
```

You can even include colors and emojis!

```bash
echo -e "--- Running \033[33mspecs\033[0m \:cow\:\:bell\:"
```

<%= image("collapsing_example.png", size: '261x127', alt: 'Screenshot of colored, emoji build output') %>

## Log output limits

If your build output exceeds 1MB then we'll only show the last 1MB of it in the rendered terminal output on your build page. In addition, your log file must not exceed 100MB else it may fail to upload.

If your log exceeds 1MB then we highly recommend reconfiguring your build tools to filter out unnecessary lines. Sometimes this isn't always possible, so you can use the below techniques to store and filter your log.

## Storing the original log

One method for storing the original log is the Unix `tee` command. It allows you to store the output stream of a command to a file and passing it straight through unchanged to the next command.

{'fraction_non_alphanumeric': 0.09346299297676931, 'fraction_numerical': 0.011885467314964884, 'mean_word_length': 4.086538461538462, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3298591', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1009, 'n_words': 557}