attach method
Tells the sink where to send reports of its own failures
(diagnostics). Called by the logger on attach (RootLogger.addSink
and the sinks from the root constructor); wrappers pass the channel to
their inner sinks (onAttach). A repeated call replaces the channel: a
sink reattached to another logger reports to it.
A sink used without a logger (for example in a test) gets its channel through this same method.
Implementation
@nonVirtual
void attach(DiagnosticReporter diagnostics) {
_diagnostics = diagnostics;
onAttach(diagnostics);
}