Skip to content

Remote Sinks

The app name and version displayed in remote sinks (Discord, Slack, Loki) are automatically read from Application.productName and Application.version — no manual configuration needed.

Remote sinks extend CloudLogSink, an abstract base that provides:

  • Per-sink filtering -> AddFilter(), RemoveFilter(), ClearFilters() (combined into a ChainedFilter)
  • Pluggable formatter -> each sink has its own Formatter property
  • Fire-and-forget async dispatch -> SendAsync() runs on Task.Run
  • Minimum level -> MinLevel drops messages below the threshold before any filter or dispatch logic runs

DiscordSink

Posts messages to a Discord channel via a webhook URL.

var discord = new DiscordSink("https://discord.com/api/webhooks/...");
Log.Container.AddSink(discord);

Default formatter: DiscordFormatter (emoji + level + file info wrapped in { "content": "..." }).

SlackSink

Posts messages to a Slack channel via a webhook URL. Uses Slack Block Kit for rich formatting.

var slack = new SlackSink("https://hooks.slack.com/services/...");
Log.Container.AddSink(slack);

Default formatter: SlackFormatter (Block Kit with emoji, level, app name, version, file info, and optional channel/username/icon).

Customize the formatter:

var formatter = new SlackFormatter
{
    Channel = "#logs",
    Username = "Logix",
    IconEmoji = ":robot:"
};
slack.Formatter = formatter;

LokiSink

Pushes log messages to Grafana Loki at {baseUrl}/loki/api/v1/push. Supports bearer token auth and X-Scope-OrgID tenant header.

var loki = new LokiSink(
    baseUrl: "http://localhost:3100",
    authToken: "your-token",
    tenantId: "my-tenant"
);
Log.Container.AddSink(loki);

Default formatter: LokiFormatter (produces Loki push API format with stream labels and optional file metadata).

HttpSink

Generic HTTP sink. POSTs or PUTs formatted messages to any endpoint with custom headers.

var config = ScriptableObject.CreateInstance<EndpointSettingsSO>();
config.Url = "https://my-api.com/logs";
config.HttpMethod = "POST";
config.ContentType = "application/json";
config.Headers.Add("Authorization: Bearer my-token");

var http = new HttpSink(config);
Log.Container.AddSink(http);

Default formatter: JsonFormatter.

WebSocketSink

Sends log messages over a ClientWebSocket connection. Auto-connects and reconnects on disconnect.

var config = ScriptableObject.CreateInstance<EndpointSettingsSO>();
config.Url = "ws://localhost:8080/logs";

var ws = new WebSocketSink(config);
Log.Container.AddSink(ws);

Default formatter: JsonFormatter. Thread-safe via SemaphoreSlim connect lock.

ScriptableObject setup

The recommended way to configure remote sinks is through ScriptableObjects:

  1. Create a Logix Settings asset: Create -> Logix -> Global Settings
  2. Create remote endpoint assets:
  3. Create -> Logix -> Remote -> Endpoint Settings (Discord, Slack, HTTP, WebSocket)
  4. Create -> Logix -> Remote -> Loki Settings (Loki)
  5. Fill in the URL, auth tokens, etc.
  6. Drag the endpoint assets into the appropriate config list on the Settings asset
  7. Drag the Settings asset onto the Editor Window toolbar to apply it

The LogixInitializer will automatically create and wire up all configured remote sinks on startup.