aono-file-handler
Version:
Aono handler that write to a log file with support for custom formatters and log rotation.
37 lines • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Builder = void 0;
const FileHandler_1 = require("./FileHandler");
const LogstashFormatter_1 = require("./LogstashFormatter");
const HUNDRED_MEGS = 100 * 1024 * 1024;
const LOGSTASH_FORMATTER = new LogstashFormatter_1.LogstashFormatter();
/**
* @author Maciej Chalapuk (maciej@chalapuk.pl)
*/
class Builder {
constructor() {
this._prefix = './logs/configure-me.log';
this._rotationBytesThreshold = HUNDRED_MEGS;
this._formatter = LOGSTASH_FORMATTER;
}
construtor() {
}
prefix(prefixArg) {
this._prefix = prefixArg;
return this;
}
rotationBytesThreshold(thresholdArg) {
this._rotationBytesThreshold = thresholdArg;
return this;
}
formatter(formatterArg) {
this._formatter = formatterArg;
return this;
}
build() {
return new FileHandler_1.FileHandler(this._prefix, this._formatter, this._rotationBytesThreshold);
}
}
exports.Builder = Builder;
exports.default = Builder;
//# sourceMappingURL=Builder.js.map