Merge pull request #5663 from NodeBB/sounds-fix
Fix soundpacks not working, auto install dependencies, defer logging in testsv1.18.x
commit
5ea8145cff
@ -0,0 +1,40 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var util = require('util');
|
||||||
|
var winston = require('winston');
|
||||||
|
|
||||||
|
function DeferLogger(options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
this.name = 'DeferLogger';
|
||||||
|
this.level = options.level || 'info';
|
||||||
|
|
||||||
|
this.logged = options.logged;
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(DeferLogger, winston.Transport);
|
||||||
|
|
||||||
|
DeferLogger.prototype.log = function log(level, msg, meta, callback) {
|
||||||
|
this.logged.push([level, msg, meta]);
|
||||||
|
callback(null, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
var winstonLogged = [];
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
// defer winston logs until the end
|
||||||
|
winston.remove(winston.transports.Console);
|
||||||
|
|
||||||
|
winston.add(DeferLogger, {
|
||||||
|
logged: winstonLogged,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
after(function () {
|
||||||
|
console.log('\n\n');
|
||||||
|
|
||||||
|
var con = new winston.transports.Console();
|
||||||
|
winstonLogged.forEach(function (args) {
|
||||||
|
con.log(args[0], args[1], args[2], function () {});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue