> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.logger.FileLogger

<h2 id="autogen.logger.FileLogger" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">FileLogger</span>
</h2>

```python theme={null}
FileLogger(config: dict[str, Any])
```

Helper class that provides a standard way to create an ABC using
inheritance.

<b>Parameters:</b>

| Name     | Description               |
| -------- | ------------------------- |
| `config` | **Type:** dict\[str, Any] |

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### get\_connection

```python theme={null}
get_connection(self) -> None
```

Method is intentionally left blank because there is no specific connection needed for the FileLogger.

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_chat\_completion

```python theme={null}
log_chat_completion(
    self,
    invocation_id: UUID,
    client_id: int,
    wrapper_id: int,
    source: str | Agent,
    request: dict[str, float | str | list[dict[str, str]]],
    response: str | ChatCompletion,
    is_cached: int,
    cost: float,
    start_time: str
) -> None
```

Log a chat completion.

<b>Parameters:</b>

| Name            | Description                                                  |
| --------------- | ------------------------------------------------------------ |
| `invocation_id` | **Type:** uuid.UUID                                          |
| `client_id`     | **Type:** int                                                |
| `wrapper_id`    | **Type:** int                                                |
| `source`        | **Type:** str \| Agent                                       |
| `request`       | **Type:** dict\[str, float \| str \| list\[dict\[str, str]]] |
| `response`      | **Type:** str \| ChatCompletion                              |
| `is_cached`     | **Type:** int                                                |
| `cost`          | **Type:** float                                              |
| `start_time`    | **Type:** str                                                |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_event

```python theme={null}
log_event(
    self,
    source: str | Agent,
    name: str,
    **kwargs: dict[str, Any]
) -> None
```

Log an event from an agent or a string source.

<b>Parameters:</b>

| Name       | Description               |
| ---------- | ------------------------- |
| `source`   | **Type:** str \| Agent    |
| `name`     | **Type:** str             |
| `**kwargs` | **Type:** dict\[str, Any] |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_function\_use

```python theme={null}
log_function_use(
    self,
    source: str | Agent,
    function: F,
    args: dict[str, Any],
    returns: Any
) -> None
```

Log a registered function(can be a tool) use from an agent or a string source.

<b>Parameters:</b>

| Name       | Description               |
| ---------- | ------------------------- |
| `source`   | **Type:** str \| Agent    |
| `function` | **Type:** F               |
| `args`     | **Type:** dict\[str, Any] |
| `returns`  | **Type:** Any             |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_new\_agent

```python theme={null}
log_new_agent(
    self,
    agent: ConversableAgent,
    init_args: dict[str, Any] = {}
) -> None
```

Log a new agent instance.

<b>Parameters:</b>

| Name        | Description                                           |
| ----------- | ----------------------------------------------------- |
| `agent`     | **Type:** ConversableAgent                            |
| `init_args` | **Type:** dict\[str, Any]<br /><br />**Default:** \{} |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_new\_client

```python theme={null}
log_new_client(
    self,
    client: AzureOpenAI | OpenAI | CerebrasClient | GeminiClient | AnthropicClient | MistralAIClient | TogetherClient | GroqClient | CohereClient | OllamaClient | BedrockClient,
    wrapper: OpenAIWrapper,
    init_args: dict[str, Any]
) -> None
```

Log a new client instance.

<b>Parameters:</b>

| Name        | Description                                                                                                                                                                              |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client`    | **Type:** AzureOpenAI \| OpenAI \| CerebrasClient \| GeminiClient \| AnthropicClient \| MistralAIClient \| TogetherClient \| GroqClient \| CohereClient \| OllamaClient \| BedrockClient |
| `wrapper`   | **Type:** OpenAIWrapper                                                                                                                                                                  |
| `init_args` | **Type:** dict\[str, Any]                                                                                                                                                                |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_new\_wrapper

```python theme={null}
log_new_wrapper(
    self,
    wrapper: OpenAIWrapper,
    init_args: dict[str, LLMConfig | list[LLMConfig]] = {}
) -> None
```

Log a new wrapper instance.

<b>Parameters:</b>

| Name        | Description                                                                     |
| ----------- | ------------------------------------------------------------------------------- |
| `wrapper`   | **Type:** OpenAIWrapper                                                         |
| `init_args` | **Type:** dict\[str, LLMConfig \| list\[LLMConfig]]<br /><br />**Default:** \{} |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### start

```python theme={null}
start(self) -> str
```

Start the logger and return the session\_id.

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### stop

```python theme={null}
stop(self) -> None
```

Close the file handler and remove it from the logger.

<br />
