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,6 +95,9 @@ class IMAPConnection extends EventEmitter {
this._closingTimeout = null;
if (server.logger) {
this.logger = server.logger;
} else {
this.logger = {};
['info', 'debug', 'error'].forEach(level => {
this.logger[level] = (...args) => {
@ -103,9 +106,14 @@ class IMAPConnection extends EventEmitter {
}
};
});
}
if (server.loggelf) {
this.loggelf = server.loggelf;
} else {
this.loggelf = () => false;
}
}
/**
* Initiates the connection. Checks connection limits and reverse resolves client hostname. The client