function sink (func) { const result = split((data) => { try { return JSON.parse(data) } catch (err) { console.log(err) console.log(data) } }) if (func) result.pipe(writer.obj(func)) return result }
test('changing level from info to silent and back to info in child logger', async ({ is }) => { const expected = { level: 30, msg: 'hello world' } const stream = sink() const child = pino({ level: 'info' }, stream).child({}) child.level = 'silent' child.info('hello world') let result = stream.read() is(result, null) child.level = 'info' child.info('hello world') result = await once(stream, 'data') check(is, result, expected.level, expected.msg) })
/// Minify the build script, after building it gulp.task('minify', () => { const gpu = gulp.src('dist/gpu-browser.js') .pipe(uglify()) .pipe(rename('gpu-browser.min.js')) .pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg })) .pipe(gulp.dest('./dist')) .on('error', console.error); const gpuCore = gulp.src('dist/gpu-browser-core.js') .pipe(uglify()) .pipe(rename('gpu-browser-core.min.js')) .pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg })) .pipe(gulp.dest('./dist')) .on('error', console.error); return merge(gpu, gpuCore); });
test('changing level from info to silent and back to info', async ({ is }) => { const expected = { level: 30, msg: 'hello world' } const stream = sink() const instance = pino({ level: 'info' }, stream) instance.level = 'silent' instance.info('hello world') let result = stream.read() is(result, null) instance.level = 'info' instance.info('hello world') result = await once(stream, 'data') check(is, result, expected.level, expected.msg) })
test('mixin object is new every time', async ({ plan, ok, same }) => { plan(6) let n = 0 const stream = sink() const instance = pino({ mixin () { return { hello: n } } }, stream) instance.level = name while (++n < 4) { const msg = `test #${n}` stream.pause() instance[name](msg) stream.resume() const result = await once(stream, 'data') ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()') delete result.time same(result, { pid, hostname, level, msg, hello: n }) } })
data.push(chunk) })
ctx.params.on("error", err => pass.emit("error", err)); return ctx.params.pipe(pass);
vfs.src([path.join(modulePath, 'dist', '_static', '**', '*.css'), path.join('!' + modulePath, 'dist', '_static', '**', '*.min.css')]) .pipe(athenaMate.cssnano(cssCompressConf)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static')))
vfs.src(path.join(modulePath, 'dist', '_static', '**')) .pipe(athenaMate.revServer({ modulePath: modulePath, revName: 'rev' })) .pipe(vfs.dest(path.join(modulePath, 'dist', 'output', 's'))) .on('end', function () { resolve(); });
vfs.src([path.join(modulePath, 'dist', '_static', 'js', '**', '*.js'), path.join('!' + modulePath, 'dist', '_static', 'js', '**','*.min.js')]) .pipe(athenaMate.uglify(jsCompressConf).on('error', $.util.log)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static', 'js')))
vfs.src(path.join(modulePath, 'dist', '_static', '**')) .pipe(athenaMate.revNoHashServer({ modulePath: modulePath, revName: 'rev' })) .pipe(vfs.dest(path.join(modulePath, 'dist', 'output', 's'))) .on('end', function () { resolve(); });
vfs.src(path.join(modulePath, 'dist', '_static', '{css,js,images}', '**')) .pipe(athenaMate.rev({ modulePath: modulePath, revName: 'rev' })) .pipe(vfs.dest(path.join(modulePath, 'dist', 'output'))) .on('end', function () { resolve(); });
vfs.src([path.join(modulePath, 'dist', '_static', '**', '*.js'), path.join('!' + modulePath, 'dist', '_static', '**', '*.min.js')]) .pipe(athenaMate.uglify(jsCompressConf).on('error', $.util.log)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static')))
vfs.src([path.join(modulePath, 'dist', '_static', 'css', '**', '*.css'), path.join('!' + modulePath, 'dist', '_static', 'css', '**', '*.min.css')]) .pipe(athenaMate.cssnano(cssCompressConf)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static', 'css')))