Location: Hercules module.
var herculesLog = new HerculesLog(new HerculesLogSettings(herculesSink, logStreamName));var dynamicallyConfiguredLog = new HerculesLog(() => ObtainSettings());
HerculesLog converts incoming log events to Hercules events according to Hercules log event schema and then sends resulting events with an instance of IHerculesSink. Additional details on events mapping can be found in module's description on GitHub.
HerculesLog is configured with
HerculesLogSettings, having 2 mandatory parameters:
An instance of sink to send events with.
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.
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 dependes on the nature of
IHerculesSink implementation. Default implementation in vostok.hercules.client repository provides a set of counters for these purposes.