Skip to content

Commit

Permalink
fix(imapconnection): inherit logger and loggelf from server for IMAPC…
Browse files Browse the repository at this point in the history
…onnection (#533)
  • Loading branch information
titanism committed Oct 16, 2023
1 parent 292bbc2 commit 667f992
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions imap-core/lib/imap-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/**
Expand Down

0 comments on commit 667f992

Please sign in to comment.