API reference / @jsprismarine/prismarine / RemoteLogTransport
Class: RemoteLogTransport
Defined in: prismarine/src/console/RemoteLogTransport.ts:40
Forwards log records to the console process as log messages.
Every record the logger emits at or above the subscribed level becomes one message with a seq that increases by one, so the console can detect a gap. While the link reports a pause (send returned false) records queue up to the capacity; the oldest fall off and are counted. Once the link drains, a single log.dropped with that count goes out before the queued records resume, so the console knows where the hole is.
When the link closes under the transport, the queue is dropped and the retry stops; there is no one left to deliver to, and close then sends nothing.
Implements
Constructors
Constructor
new RemoteLogTransport(
link,options?):RemoteLogTransport
Defined in: prismarine/src/console/RemoteLogTransport.ts:56
Parameters
link
FlushableLink<ConsoleMessage, ServerMessage>
The server end of the console link.
options?
RemoteLogTransportOptions = {}
Queue capacity and retry delay.
Returns
RemoteLogTransport
Accessors
dropped
Get Signature
get dropped():
number
Defined in: prismarine/src/console/RemoteLogTransport.ts:66
Records dropped from the queue and not yet announced with a log.dropped message.
Returns
number
pending
Get Signature
get pending():
number
Defined in: prismarine/src/console/RemoteLogTransport.ts:71
Records waiting for the link to drain.
Returns
number
Methods
close()
close():
void
Defined in: prismarine/src/console/RemoteLogTransport.ts:115
Hands every queued record to the link at once, with the pending log.dropped first, and stops accepting records. The link queues them itself even while it reports a pause, so nothing here is lost; whether they reach the other end before the process exits is up to the link's flush.
Returns
void
Implementation of
log()
log(
record):void
Defined in: prismarine/src/console/RemoteLogTransport.ts:87
Forwards the record, or queues it while the link is paused. Records logged after close are ignored.
Parameters
record
Returns
void
Implementation of
setLevel()
setLevel(
level):void
Defined in: prismarine/src/console/RemoteLogTransport.ts:79
Sets the least severe level still forwarded. Records below it are skipped and consume no seq. Defaults to silly, which forwards everything the logger emits.
Parameters
level
"warn" | "error" | "info" | "verbose" | "debug" | "silly"
Returns
void