Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #148 from johnnywengluu/patch-8

Add example for showing exception handling
  • Loading branch information...
commit 94c6518cf061520a1da6a1eb2f8dced74c7d0570 2 parents b8d93b4 + 4d050a5
@pksunkara pksunkara authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.md
View
16 README.md
@@ -188,6 +188,8 @@ set `exitOnError = false`
When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport.
+Example 1
+
``` js
var logger = new (winston.Logger)({
transports: [
@@ -199,6 +201,20 @@ When working with custom logger instances, you can pass in separate transports t
});
```
+Example 2
+
+```
+var logger = new winston.Logger({
+ transports: [
+ new winston.transports.Console({
+ handleExceptions: true,
+ json: true
+ })
+ ],
+ exitOnError: false
+});
+```
+
The `exitOnError` option can also be a function to prevent exit on only certain types of errors:
``` js
Please sign in to comment.
Something went wrong with that request. Please try again.