Merge pull request #486 from tejasmanohar/app_silent
app.silent option to turn off err logging
This commit is contained in:
commit
f875eb0c30
2 changed files with 4 additions and 1 deletions
|
@ -166,6 +166,8 @@ app.onerror = function(err){
|
||||||
assert(err instanceof Error, 'non-error thrown: ' + err);
|
assert(err instanceof Error, 'non-error thrown: ' + err);
|
||||||
|
|
||||||
if (404 == err.status || err.expose) return;
|
if (404 == err.status || err.expose) return;
|
||||||
|
if (this.silent) return;
|
||||||
|
// DEPRECATE env-specific logging in v2
|
||||||
if ('test' == this.env) return;
|
if ('test' == this.env) return;
|
||||||
|
|
||||||
var msg = err.stack || err.toString();
|
var msg = err.stack || err.toString();
|
||||||
|
|
|
@ -161,8 +161,9 @@ describe('app.onerror(err)', function(){
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should do nothing if env is test', function(done){
|
it('should do nothing if .silent', function(done){
|
||||||
var app = koa();
|
var app = koa();
|
||||||
|
app.silent = true;
|
||||||
var err = new Error();
|
var err = new Error();
|
||||||
|
|
||||||
var output = stderr.inspectSync(function() {
|
var output = stderr.inspectSync(function() {
|
||||||
|
|
Loading…
Reference in a new issue