Browse files

[doc] Update README.md with new `exitOnError` functionality

  • Loading branch information...
1 parent 0409cd7 commit 5d1acae20063e169688e8e9c52a83c43eb16833a @indexzero indexzero committed Oct 9, 2011
Showing with 20 additions and 6 deletions.
  1. +20 −6 README.md
View
26 README.md
@@ -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.
@@ -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.

0 comments on commit 5d1acae

Please sign in to comment.