File tree 7 files changed +1922
-6
lines changed
7 files changed +1922
-6
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "parser" : " @typescript-eslint/parser" ,
3
+ "plugins" : [
4
+ " @typescript-eslint"
5
+ ],
6
+ "env" : {
7
+ "node" : true ,
8
+ "es6" : true
9
+ },
10
+ "extends" : [
11
+ " airbnb-base" ,
12
+ " plugin:@typescript-eslint/recommended"
13
+ ],
14
+ "rules" : {
15
+ "@typescript-eslint/no-explicit-any" : " off"
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ # Logs
2
+ logs
3
+ * .log
4
+ npm-debug.log *
5
+ yarn-debug.log *
6
+ yarn-error.log *
7
+ lerna-debug.log *
8
+
9
+ # Diagnostic reports (https://nodejs.org/api/report.html)
10
+ report. [0-9 ]* . [0-9 ]* . [0-9 ]* . [0-9 ]* .json
11
+
12
+ # Runtime data
13
+ pids
14
+ * .pid
15
+ * .seed
16
+ * .pid.lock
17
+
18
+ # Directory for instrumented libs generated by jscoverage/JSCover
19
+ lib-cov
20
+
21
+ # Coverage directory used by tools like istanbul
22
+ coverage
23
+ * .lcov
24
+
25
+ # nyc test coverage
26
+ .nyc_output
27
+
28
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29
+ .grunt
30
+
31
+ # Bower dependency directory (https://bower.io/)
32
+ bower_components
33
+
34
+ # node-waf configuration
35
+ .lock-wscript
36
+
37
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
38
+ build /Release
39
+
40
+ # Dependency directories
41
+ node_modules /
42
+ jspm_packages /
43
+
44
+ # TypeScript v1 declaration files
45
+ typings /
46
+
47
+ # TypeScript cache
48
+ * .tsbuildinfo
49
+
50
+ # Optional npm cache directory
51
+ .npm
52
+
53
+ # Optional eslint cache
54
+ .eslintcache
55
+
56
+ # Microbundle cache
57
+ .rpt2_cache /
58
+ .rts2_cache_cjs /
59
+ .rts2_cache_es /
60
+ .rts2_cache_umd /
61
+
62
+ # Optional REPL history
63
+ .node_repl_history
64
+
65
+ # Output of 'npm pack'
66
+ * .tgz
67
+
68
+ # Yarn Integrity file
69
+ .yarn-integrity
70
+
71
+ # dotenv environment variables file
72
+ .env
73
+ .env.test
74
+
75
+ # parcel-bundler cache (https://parceljs.org/)
76
+ .cache
77
+
78
+ # next.js build output
79
+ .next
80
+
81
+ # nuxt.js build output
82
+ .nuxt
83
+
84
+ # gatsby files
85
+ .cache /
86
+ public
87
+
88
+ # vuepress build output
89
+ .vuepress /dist
90
+
91
+ # Serverless directories
92
+ .serverless /
93
+
94
+ # FuseBox cache
95
+ .fusebox /
96
+
97
+ # DynamoDB Local files
98
+ .dynamodb /
99
+
100
+ # Build result
101
+ lib
Original file line number Diff line number Diff line change 1
1
# winston-sentry-javascript-node
2
2
3
- Sentry transport for the winson logger that using official Sentry SDK for javascript instead of the old Raven.
3
+ [ ![ winston] ( https://img.shields.io/badge/winston-3.x+-brightgreen.svg )] [ winston-url ]
4
+
5
+ Sentry transport for the winson logger and uses the [ @sentry/node ] ( https://github.com/getsentry/sentry-javascript/tree/master/packages/node ) SDK instead of the old Raven.
6
+
7
+ > This package is written in Typescript with the well typing and code quality.
8
+
9
+ ## Installation
10
+
11
+ ` npm install winston-sentry-javascript-node --save `
12
+
13
+ ## Usage
14
+
15
+ ``` javascript
16
+ import { SentryTransport } from ' winston-sentry-javascript-node' ;
17
+
18
+ const logger = winston .createLogger ({
19
+ transports: [
20
+ new SentryTransport ({
21
+ dsn: ' MY_SENTRY_DSN' ,
22
+ }),
23
+ ],
24
+ });
25
+
26
+ logger .error (' Plain text error.' );
27
+ logger .error (new Error (' Something went wrong.' ));
28
+ ```
29
+
30
+ ### Extra / Tags / User Example
31
+
32
+ Set user information, as well as tags and further extras.
33
+
34
+ ``` javascript
35
+ logger .error (' Plain text error.' , {
36
+ extra: {
37
+ foo: ' bar' ,
38
+ },
39
+ tags: {
40
+ foo: ' bar'
41
+ },
42
+ user: {
43
+ ip: ' 127.0.0.1' ,
44
+ username: ' user1'
45
+ }
46
+ });
47
+ ```
48
+
49
+ ### Handle Exception
50
+
51
+ Catch and send ` uncaughtException ` to the Sentry.
52
+
53
+ ``` javascript
54
+ const logger = winston .createLogger ({
55
+ transports: [
56
+ new SentryTransport ({
57
+ dsn: ' MY_SENTRY_DSN' ,
58
+ handleExceptions: true ,
59
+ }),
60
+ ],
61
+ });
62
+
63
+ // or
64
+
65
+ const logger = winston .createLogger ({
66
+ exceptionHandlers: [
67
+ new SentryTransport ({
68
+ dsn: ' MY_SENTRY_DSN' ,
69
+ }),
70
+ ]
71
+ });
72
+ ```
73
+
74
+ ## Default Extra for Error Object
75
+
76
+ By default, if you provide an Error Object to logger, this package will set the following extra:
77
+
78
+ ``` javascript
79
+ {
80
+ stack: err .stack ,
81
+ message: err .message
82
+ }
83
+ ```
4
84
5
85
---
6
86
You can’t perform that action at this time.
0 commit comments