Skip to content

Commit

Permalink
[doc] Update README.md with new exitOnError functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Oct 9, 2011
1 parent 0409cd7 commit 5d1acae
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions README.md
Expand Up @@ -99,13 +99,12 @@ by default, winston will exit after logging an uncaughtException. if this is not
set `exitOnError = false`

``` js
var logger = new (winston.Logger)({ exitOnError: false });

var logger = new (winston.Logger)({exitOnError: false})

//or, like this:

logger.exitOnError = false

//
// or, like this:
//
logger.exitOnError = false;
```

When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport.
Expand All @@ -121,6 +120,21 @@ When working with custom logger instances, you can pass in separate transports t
});
```

The `exitOnError` option can also be a function to prevent exit on only certain types of errors:

``` js
function ignoreEpipe(err) {
return err.code !== 'EPIPE';
}

var logger = new (winston.Logger)({ exitOnError: ignoreEpipe });

//
// or, like this:
//
logger.exitOnError = ignoreEpipe;
```

### Using Logging Levels
Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger.

Expand Down

0 comments on commit 5d1acae

Please sign in to comment.