Skip to content

Modern Log AddSink

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Logging › Logging › AddSink

AddSink

Attaches a sink to the logger, which keeps a pointer to it and does not own it.

Syntax

AddSink( s as Sink ptr )

Notes

  • the LOGGER DOES NOT OWN THE SINK

Examples

#import "std/logs"
using logs

'' THE LOGGER DOES NOT OWN THE SINK -- it stores a pointer, so the sink
'' must outlive the logger. Declaring both in the same scope, sink first,
'' is the shape that guarantees it.
dim con as ConsoleSink
dim lg as Logger

lg.AddSink( @con )
print lg.SinkCount( )        '' 1

lg.Info( "goes to the console" )

Library: Logging
Category: Logging
Documented under: Members

Clone this wiki locally