> For the complete documentation index, see [llms.txt](https://vostok.gitbook.io/logging/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vostok.gitbook.io/logging/implementations/hercules-log.md).

# Hercules log

**Location**: [Hercules](/logging/modules/hercules.md) module.

```csharp
var herculesLog = new HerculesLog(new HerculesLogSettings(herculesSink, logStreamName));
var dynamicallyConfiguredLog = new HerculesLog(() => ObtainSettings());
```

`HerculesLog` converts incoming [log events](/logging/concepts/log-events.md) to [Hercules events](https://github.com/vostok/hercules/tree/master/hercules-protocol) according to [Hercules log event schema](https://github.com/vostok/hercules/blob/master/doc/event-schema/log-event-schema.md) and then sends resulting events with an instance of [IHerculesSink](https://github.com/vostok/hercules.client.abstractions/blob/master/Vostok.Hercules.Client.Abstractions/IHerculesSink.cs). Additional details on events mapping can be found in module's [description on GitHub](https://github.com/vostok/logging.hercules).

## Configuration

`HerculesLog` is configured with `HerculesLogSettings`, having 2 mandatory parameters:

| Option         | Description                                    |
| -------------- | ---------------------------------------------- |
| `HerculesSink` | An instance of sink to send events with.       |
| `Stream`       | Name of the Hercules stream to send events to. |

Ensure that provided sink instance is configured with an API key with sufficient permissions to write into selected stream.

## Usage tips

* Prefer to use a singleton instance of `IHerculesSink` everywhere in the application, including `HerculesLog`. Sink instances involve background tasks and are therefore quite expensive.
* Reporting of lost of log events generally depends on the nature of `IHerculesSink` implementation. Default implementation in [vostok.hercules.client](https://github.com/vostok/hercules.client) repository provides a set of counters for these purposes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vostok.gitbook.io/logging/implementations/hercules-log.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
