Skip to content

API reference / @jsprismarine/logger / FileTransport

Class: FileTransport ​

Defined in: transport.ts:117

Transport that appends plain-text lines to a log file. Colors are stripped, and the containing directory is created when missing.

Every record starts at the beginning of a line with its timestamp, and every further line of the same record - a stack trace, or a line break inside text a client sent - is indented by CONTINUATION_INDENT. A player could otherwise put a line break and a fake [12:00:00] [INFO] header into a book title or a name and have it read as a record the server wrote. A lone carriage return counts as a line break, so it cannot hide text in front of it either.

Implements ​

Constructors ​

Constructor ​

new FileTransport(options): FileTransport

Defined in: transport.ts:126

Parameters ​

options ​

Where to write and how verbose to be.

filename ​

string

Path of the log file to append to.

level? ​

"error" | "warn" | "info" | "verbose" | "debug" | "silly"

Most verbose level written to the file; defaults to debug.

Returns ​

FileTransport

Methods ​

close() ​

close(): void

Defined in: transport.ts:141

Returns ​

void

Implementation of ​

LogTransport.close


log() ​

log(record): void

Defined in: transport.ts:132

Parameters ​

record ​

LogRecord

Returns ​

void

Implementation of ​

LogTransport.log