add method
Accepts an entry (onAdd). Throws StateError after close: logging
into a closed sink is a shutdown-order bug, better seen than silently
sent to a closed store. The RootLogger fan-out catches such errors and
reports them to diagnostics.
Implementation
@nonVirtual
void add(LogEntry entry) {
if (_isClosed) throw StateError('$name is closed');
onAdd(entry);
}