Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add example for showing exception handling

  • Loading branch information...
commit 4d050a5869cf11325936a8c67479f7246a6a637d 1 parent e417d59
@ubun2 ubun2 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.