-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Skip log if options.silent=true. - Add example.
- Loading branch information
1 parent
482de63
commit 48069cf
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import winston from 'winston'; | ||
|
||
import { SentryTransport } from '../src/index'; | ||
|
||
const logger = winston.createLogger({ | ||
transports: [ | ||
new SentryTransport({ | ||
dsn: process.env.SENTRY_DSN, | ||
level: 'error', | ||
handleExceptions: true, | ||
}) | ||
] | ||
}) | ||
|
||
logger.error('Plain text error.'); | ||
logger.error(new Error('Something went wrong.')); | ||
logger.error('Plain text error.', { | ||
extra: { | ||
foo: 'bar', | ||
}, | ||
tags: { | ||
foo: 'bar', | ||
}, | ||
user: { | ||
ip: '127.0.0.1', | ||
username: 'user1', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters