@graphty/graphty-element / logging / Sink
Interface: Sink ​
Defined in: graphty-element/src/logging/types.ts:49
A destination log records are delivered to: the console, a log server, a panel in a page.
A plain object, not a class to extend. The element's own two destinations are exactly this shape, so what a third party writes is what the element writes.
write is synchronous and fire-and-forget: a promise it returns is neither awaited nor caught, so an async write that rejects becomes an unhandled rejection rather than the caught, reported failure a synchronous throw gets. A destination that talks to a network buffers inside write and does the talking in flush, which is what the element's own remote destination does.
Properties ​
categories? ​
optionalcategories?: readonlystring[]
Defined in: graphty-element/src/logging/types.ts:69
Take only records whose category contains one of these segments, e.g. ["layout"].
Matched the way the global module filter is matched: by segment, so "layout" takes ["graphty", "layout", "ngraph"] as well as ["graphty", "layout"].
level? ​
optionallevel?:LogLevel
Defined in: graphty-element/src/logging/types.ts:62
Take less than the global settings allow: records above this level are not delivered here.
It NARROWS and cannot widen -- a destination cannot see what the global level already dropped, because the element's own destinations are behind that same gate.
name ​
name:
string
Defined in: graphty-element/src/logging/types.ts:51
The name it is filed under, and the name removeSink takes.
Methods ​
dispose()? ​
optionaldispose():void|Promise<void>
Defined in: graphty-element/src/logging/types.ts:77
Let go of whatever the destination is holding -- a timer, a socket, a queue.
Called when the destination is removed and when another one replaces its name. The element's own remote destination needs it: its client holds a batch timer that nothing stopped before this existed.
Returns ​
void | Promise<void>
flush()? ​
optionalflush():Promise<void>
Defined in: graphty-element/src/logging/types.ts:55
Send anything buffered, when there is any. One destination's rejection does not stop another's.
Returns ​
Promise<void>
write() ​
write(
record):void
Defined in: graphty-element/src/logging/types.ts:53
Deliver one record. Anything thrown here is caught and reported, and the other destinations still get the record.
Parameters ​
record ​
Returns ​
void