Optional
allowOptional
interceptThis function will be used to intercept and possibly modify log data.
If the function returns X, then the log data will Y:
options = {
intercept: (data) => {
if (data[0] instanceof Error) {
return ["Intercepted Error: " + data[0].message];
}
}
};
logger.log([1, 2]);
// => [1, 2]
logger.log(new Error("Test Error"));
// => Intercepted Error: Test Error
Optional
interceptThis function will be used to intercept and possibly modify log messages.
This is different than interceptData, because the logger will format the log data first and then pass the resulting string to this.
If the function returns X, then the log message will Y:
Optional
levelDetermines the verbosity of the output.
options = {
level: (importance) => importance >= 1 && importance <= 2, // Importance values between INFO and WARN
};
logger.debug("Some really detailed information");
// No output.
logger.info("Something just happened!");
// -> Something just happened!
logger.warn("This should be fixed though...");
// -> This should be fixed though
logger.error("Something went horribly wrong!!!");
// No output.
Optional
prefixThe prefix function that will be used to format the log message.
This is applied after interceptString is called.
If the stream is a Logger instance, this function will not be called.
Stream that will be used to output the log messages. If the stream is a Logger instance, the output will be logged to the stream. without filtering and without a prefix.
Generated using TypeDoc
Whether or not to write pinned lines to this stream.
Default
true