# Logging methods

🤗 Evaluate strives to be transparent and explicit about how it works, but this can be quite verbose at times. We have included a series of logging methods which allow you to easily adjust the level of verbosity of the entire library. Currently the default verbosity of the library is set to `WARNING`.

To change the level of verbosity, use one of the direct setters. For instance, here is how to change the verbosity to the `INFO` level:

```py
import evaluate
evaluate.logging.set_verbosity_info()
```

You can also use the environment variable `EVALUATE_VERBOSITY` to override the default verbosity, and set it to one of the following: `debug`, `info`, `warning`, `error`, `critical`:

```bash
EVALUATE_VERBOSITY=error ./myprogram.py
```

All the methods of this logging module are documented below. The main ones are:

- [logging.get_verbosity()](/docs/evaluate/main/en/package_reference/logging_methods#evaluate.utils.logging.get_verbosity) to get the current level of verbosity in the logger
- [logging.set_verbosity()](/docs/evaluate/main/en/package_reference/logging_methods#evaluate.utils.logging.set_verbosity) to set the verbosity to the level of your choice

In order from the least to the most verbose (with their corresponding `int` values):

1. `logging.CRITICAL` or `logging.FATAL` (int value, 50): only report the most critical errors.
2. `logging.ERROR` (int value, 40): only report errors.
3. `logging.WARNING` or `logging.WARN` (int value, 30): only reports error and warnings. This the default level used by the library.
4. `logging.INFO` (int value, 20): reports error, warnings and basic information.
5. `logging.DEBUG` (int value, 10): report all information.

By default, `tqdm` progress bars will be displayed during evaluate download and processing. [logging.disable_progress_bar()](/docs/evaluate/main/en/package_reference/logging_methods#evaluate.disable_progress_bar) and [logging.enable_progress_bar()](/docs/evaluate/main/en/package_reference/logging_methods#evaluate.enable_progress_bar) can be used to suppress or unsuppress this behavior. 

## Functions[[evaluate.utils.logging.get_verbosity]]

#### evaluate.utils.logging.get_verbosity[[evaluate.utils.logging.get_verbosity]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L85)

Return the current level for the Hugging Face Evaluate library's root logger.

> [!TIP]
> Hugging Face Evaluate library has following logging levels:
>     - `evaluate.logging.CRITICAL`, `evaluate.logging.FATAL`
>     - `evaluate.logging.ERROR`
>     - `evaluate.logging.WARNING`, `evaluate.logging.WARN`
>     - `evaluate.logging.INFO`
>     - `evaluate.logging.DEBUG`

**Returns:**

Logging level, e.g., `evaluate.logging.DEBUG` and `evaluate.logging.INFO`.

#### evaluate.utils.logging.set_verbosity[[evaluate.utils.logging.set_verbosity]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L101)

Set the level for the Hugging Face Evaluate library's root logger.

**Parameters:**

verbosity : Logging level, e.g., `evaluate.logging.DEBUG` and `evaluate.logging.INFO`.

#### evaluate.utils.logging.set_verbosity_info[[evaluate.utils.logging.set_verbosity_info]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L110)

Set the level for the Hugging Face Evaluate library's root logger to `INFO`.

This will display most of the logging information and tqdm bars.

Shortcut to `evaluate.logging.set_verbosity(evaluate.logging.INFO)`.

#### evaluate.utils.logging.set_verbosity_warning[[evaluate.utils.logging.set_verbosity_warning]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L120)

Set the level for the Hugging Face Evaluate library's root logger to `WARNING`.

This will display only the warning and errors logging information and tqdm bars.

Shortcut to `evaluate.logging.set_verbosity(evaluate.logging.WARNING)`.

#### evaluate.utils.logging.set_verbosity_debug[[evaluate.utils.logging.set_verbosity_debug]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L130)

Set the level for the Hugging Face Evaluate library's root logger to `DEBUG`.

This will display all the logging information and tqdm bars.

Shortcut to `evaluate.logging.set_verbosity(evaluate.logging.DEBUG)`.

#### evaluate.utils.logging.set_verbosity_error[[evaluate.utils.logging.set_verbosity_error]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L140)

Set the level for the Hugging Face Evaluate library's root logger to `ERROR`.

This will display only the errors logging information and tqdm bars.

Shortcut to `evaluate.logging.set_verbosity(evaluate.logging.ERROR)`.

#### evaluate.utils.logging.disable_propagation[[evaluate.utils.logging.disable_propagation]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L150)

Disable propagation of the library log outputs.
Note that log propagation is disabled by default.

#### evaluate.utils.logging.enable_propagation[[evaluate.utils.logging.enable_propagation]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L157)

Enable propagation of the library log outputs.
Please disable the Hugging Face Evaluate library's default handler to prevent double logging if the root logger has
been configured.

#### evaluate.utils.logging.get_logger[[evaluate.utils.logging.get_logger]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L78)

Return a logger with the specified name.

#### evaluate.enable_progress_bar[[evaluate.enable_progress_bar]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L221)

Enable tqdm progress bar.

#### evaluate.disable_progress_bar[[evaluate.disable_progress_bar]]

[Source](https://github.com/huggingface/evaluate/blob/main/src/evaluate/utils/logging.py#L227)

Enable tqdm progress bar.

## Levels

### evaluate.logging.CRITICAL

evaluate.logging.CRITICAL = 50

### evaluate.logging.DEBUG

evaluate.logging.DEBUG = 10

### evaluate.logging.ERROR

evaluate.logging.ERROR = 40

### evaluate.logging.FATAL

evaluate.logging.FATAL = 50

### evaluate.logging.INFO

evaluate.logging.INFO = 20

### evaluate.logging.NOTSET

evaluate.logging.NOTSET = 0

### evaluate.logging.WARN

evaluate.logging.WARN = 30

### evaluate.logging.WARNING

evaluate.logging.WARNING = 30

