# Miscellaneous Modules

{% hint style="info" %}
This API Reference is based on PySDK 0.20.0.
{% endhint %}

## degirum.log.DGLog

Console logging class with programmable verbosity.

## print(message) <a href="#degirum.log.dglog.print" id="degirum.log.dglog.print"></a>

`degirum.log.DGLog.print(message)`

`staticmethod`

Print message to log according to current verbosity level.

Parameters:

| Name      | Type  | Description              | Default    |
| --------- | ----- | ------------------------ | ---------- |
| `message` | `str` | Message string to print. | *required* |

## set\_verbose\_state(state) <a href="#degirum.log.dglog.set_verbose_state" id="degirum.log.dglog.set_verbose_state"></a>

`degirum.log.DGLog.set_verbose_state(state)`

`staticmethod`

Set log verbosity state.

Parameters:

| Name    | Type   | Description                                                                    | Default    |
| ------- | ------ | ------------------------------------------------------------------------------ | ---------- |
| `state` | `bool` | If `True`, then log prints messages to console, otherwise no messages printed. | *required* |

## degirum.log.async\_log\_wrap(f=None, \*, log\_level=logging.DEBUG)

{% code overflow="wrap" %}

```
async_log_wrap(f: Callable[P, Awaitable[R]]) -> Callable[P, Awaitable[R]]
```

{% endcode %}

{% code overflow="wrap" %}

```
async_log_wrap(*, log_level: int = logging.DEBUG) -> Callable[[Callable[P, Awaitable[R]]], Callable[P, Awaitable[R]]]
```

{% endcode %}

Decorator to log async function entry and exit with execution time.

Parameters:

| Name        | Type       | Description                       | Default |
| ----------- | ---------- | --------------------------------- | ------- |
| `f`         | `Callable` | Async function to log.            | `None`  |
| `log_level` | `int`      | Logging level of the log entries. | `DEBUG` |

## degirum.log.log\_wrap(f=None, \*, log\_level=logging.DEBUG)

{% code overflow="wrap" %}

```
log_wrap(f: Callable[P, R]) -> Callable[P, R]
```

{% endcode %}

{% code overflow="wrap" %}

```
log_wrap(*, log_level: int = logging.DEBUG) -> Callable[[Callable[P, R]], Callable[P, R]]
```

{% endcode %}

Decorator to log function entry and exit with execution time.

Parameters:

| Name        | Type       | Description                       | Default |
| ----------- | ---------- | --------------------------------- | ------- |
| `f`         | `Callable` | Sync function to log              | `None`  |
| `log_level` | `int`      | Logging level of the log entries. | `DEBUG` |

## degirum.exceptions.DegirumException

Bases: `Exception`

Base type for all DeGirum exceptions.

## degirum.exceptions.validate\_color\_tuple(color)

Validate if color has acceptable representation.

Parameters:

| Name    | Type  | Description               | Default    |
| ------- | ----- | ------------------------- | ---------- |
| `color` | `Any` | Color object to validate. | *required* |

Raises:

| Type                                                       | Description                                                               |
| ---------------------------------------------------------- | ------------------------------------------------------------------------- |
| [`DegirumException`](#degirum.exceptions.DegirumException) | if color is not a three-element tuple and each element is integer number. |

Returns:

| Type    | Description                        |
| ------- | ---------------------------------- |
| `tuple` | color sequence converted to tuple. |
