> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.getfoundry.sh/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

## `verbosity`

:::note
Not in v1.10.1. Available in nightly builds from 2026-11-29 ([foundry#18691](https://github.com/foundry-rs/foundry/pull/18691)). Builds without [foundry#18939](https://github.com/foundry-rs/foundry/pull/18939) ignore the `verbosity` setting and count only `-v` flags. forge-std 1.17.0 does not declare it yet, so the example uses its own interface.
:::

### Signature

```solidity
function verbosity() external view returns (uint8 level);
```

### Description

Returns the verbosity level of the running `forge` command, so a test or script can print extra detail only when the user asked for it. The level is the number of `-v` flags on the command line. Without `-v` flags, it is the [`verbosity`](/config/reference/testing#verbosity) setting from `foundry.toml` or `FOUNDRY_VERBOSITY`, which defaults to `0`.

With no `verbosity` setting:

| Command              | `vm.verbosity()` |
|----------------------|------------------|
| `forge test`         | `0`              |
| `forge test -v`      | `1`              |
| `forge test -vv`     | `2`              |
| `forge test -vvv`    | `3`              |
| `forge test -vvvv`   | `4`              |
| `forge test -vvvvv`  | `5`              |

With `verbosity = 2` in `foundry.toml`, `forge test` returns `2` and `forge test -v` returns `1`.

`--quiet` does not change the value: `forge test -q` returns the same value as `forge test`. `-q` cannot be combined with `-v`.

### Returns

| Name    | Type    | Description                                                     |
|---------|---------|-----------------------------------------------------------------|
| `level` | `uint8` | Number of `-v` flags, or the `verbosity` setting without them   |

### Examples

#### Log only at `-vv` and above

```solidity [test/Verbosity.t.sol]
// [!include ~/snippets/projects/verbosity/test/Verbosity.t.sol:gated]
```

```bash
$ forge test --root src/snippets/projects/verbosity -vv
[PASS] test_logOnlyWhenVerbose() (gas: 7409)
Logs:
  total = 7
```

Without `-vv` the test passes and emits no log.

### Related Cheatcodes

* [`foundryVersion`](/reference/cheatcodes/foundry-version) - Reads and compares the Foundry version running the tests
