fix(imapconnection): inherit logger and loggelf from server for IMAPConnection (#533)

This commit is contained in:
titanism 2023-10-16 04:01:20 -05:00 committed by GitHub
parent 292bbc2821
commit 667f992ca4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,16 +95,24 @@ class IMAPConnection extends EventEmitter {
this._closingTimeout = null;
this.logger = {};
['info', 'debug', 'error'].forEach(level => {
this.logger[level] = (...args) => {
if (!this.ignore) {
this._server.logger[level](...args);
}
};
});
if (server.logger) {
this.logger = server.logger;
} else {
this.logger = {};
['info', 'debug', 'error'].forEach(level => {
this.logger[level] = (...args) => {
if (!this.ignore) {
this._server.logger[level](...args);
}
};
});
}
this.loggelf = () => false;
if (server.loggelf) {
this.loggelf = server.loggelf;
} else {
this.loggelf = () => false;
}
}
/**