Skip to main content

Built-in sinks

SimpleLineSink​

class SimpleLineSink extends LogSink

Prints a readable line to the terminal, interpolating {placeholders} in LogModel.mt with values from LogModel.data.

logger.addSink(SimpleLineSink());

DefaultSink​

class DefaultSink extends LogSink

Writes the event map (event.toMap().toString()) to the Dart developer log via dart:developer.

logger.addSink(DefaultSink());

SinkSeq​

class SinkSeq extends LogSink

Sends events in CLEF format to a Seq server via HTTP POST.

Constructor​

SinkSeq(
String seqUrl, {
String? apiKey,
String? deviceIdentifier,
http.Client? client,
})
ParameterDescription
seqUrlAbsolute Seq server URL
apiKeyOptional API key (X-Seq-ApiKey header)
deviceIdentifierIdentifier included in the CLEF event
clientInjectable HTTP client for tests

Throws ArgumentError if seqUrl is not an absolute URL.

close()​

void close()

Closes the internal http.Client when no client was injected in the constructor.

Example​

final sink = SinkSeq(
'https://seq.example.com',
apiKey: 'key',
deviceIdentifier: 'device-1',
);
logger.addSink(sink);

// on dispose
sink.close();

See the Seq integration guide for full configuration.