mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-29 03:36:06 +08:00
fix(imapconnection): inherit logger and loggelf from server for IMAPConnection (#533)
This commit is contained in:
parent
292bbc2821
commit
667f992ca4
1 changed files with 17 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue