> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/labs-voice-agent/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/labs-voice-agent/_mcp/server.

# nemo_voice_agent.utils.misc

## Module Contents

### Classes

| Name                                                    | Description                                              |
| ------------------------------------------------------- | -------------------------------------------------------- |
| [`FileLogger`](#nemo_voice_agent-utils-misc-FileLogger) | Simple file+stdout logger with caller location tracking. |

### Functions

| Name                                                                    | Description                                                                |
| ----------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`setup_logging`](#nemo_voice_agent-utils-misc-setup_logging)           | Configure loguru to emit to stderr and a rotating log file.                |
| [`setup_rotating_log`](#nemo_voice_agent-utils-misc-setup_rotating_log) | Roll an existing log file aside (or delete it), then call `setup_logging`. |

### API

```python
class nemo_voice_agent.utils.misc.FileLogger(
    log_file: typing.Optional[str] = None,
    mode: str = 'w'
)
```

Simple file+stdout logger with caller location tracking.

```python
nemo_voice_agent.utils.misc.FileLogger.__call__(
    message: str,
    include_caller: bool = True
)
```

Allow calling the logger instance directly like a function.

```python
nemo_voice_agent.utils.misc.FileLogger._get_caller_location() -> str
```

Return file:function:line of the caller, skipping frames inside FileLogger.

```python
nemo_voice_agent.utils.misc.FileLogger.debug(
    message: str,
    include_caller: bool = True
)
```

Log at DEBUG level.

```python
nemo_voice_agent.utils.misc.FileLogger.error(
    message: str,
    include_caller: bool = True
)
```

Log at ERROR level.

```python
nemo_voice_agent.utils.misc.FileLogger.info(
    message: str,
    include_caller: bool = True
)
```

Log at INFO level.

```python
nemo_voice_agent.utils.misc.FileLogger.log(
    message: str,
    include_caller: bool = True
)
```

Write a timestamped line to the log file (if set) and stdout.

```python
nemo_voice_agent.utils.misc.FileLogger.warning(
    message: str,
    include_caller: bool = True
)
```

Log at WARNING level.

```python
nemo_voice_agent.utils.misc.setup_logging(
    log_file: str = 'bot_server.log',
    log_level: str = 'DEBUG',
    rotation: str = '1 day'
)
```

Configure loguru to emit to stderr and a rotating log file.

```python
nemo_voice_agent.utils.misc.setup_rotating_log(
    log_file: str,
    log_level: str = 'DEBUG',
    create_new_log: bool = False,
    overwrite_existing: bool = False,
    rotation: str = '1 day'
) -> None
```

Roll an existing log file aside (or delete it), then call `setup_logging`.

If `create_new_log` is True and the file exists, it is either removed
(`overwrite_existing=True`) or renamed with a timestamp suffix. Used by
bot server scripts that want a fresh log on every run.