@sentry/node
Advanced tools
Comparing version 0.4.0-beta.4 to 0.4.0-beta.5
@@ -1,3 +0,2 @@ | ||
export { SentryNode, NodeOptions as SentryNodeOptions } from './lib/node'; | ||
export { default as Store } from './lib/store'; | ||
export { mkdirp, mkdirpSync } from './lib/utils'; | ||
export * from './lib/backend'; | ||
export * from './lib/frontend'; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var node_1 = require("./lib/node"); | ||
exports.SentryNode = node_1.SentryNode; | ||
var store_1 = require("./lib/store"); | ||
exports.Store = store_1.default; | ||
var utils_1 = require("./lib/utils"); | ||
exports.mkdirp = utils_1.mkdirp; | ||
exports.mkdirpSync = utils_1.mkdirpSync; | ||
__export(require("./lib/backend")); | ||
__export(require("./lib/frontend")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@sentry/node", | ||
"version": "0.4.0-beta.4", | ||
"version": "0.4.0-beta.5", | ||
"description": "Offical Sentry SDK for Node.js", | ||
"repository": "https://github.com/getsentry/raven-js", | ||
"author": "Sentry", | ||
@@ -16,46 +17,29 @@ "license": "MIT", | ||
"dependencies": { | ||
"@sentry/core": "^0.4.0-beta.4", | ||
"raven": "^2.4.0" | ||
"@sentry/core": "^0.4.0-beta.5", | ||
"@sentry/utils": "^0.4.0-beta.5", | ||
"raven": "^2.4.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "*", | ||
"chai": "*", | ||
"jest": "*", | ||
"prettier": "*", | ||
"rimraf": "*", | ||
"sinon": "*", | ||
"ts-jest": "*", | ||
"tslint": "*", | ||
"typescript": "*" | ||
"chai": "^4.1.2", | ||
"jest": "^22.4.2", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "^1.11.1", | ||
"prettier-check": "^2.0.0", | ||
"rimraf": "^2.6.2", | ||
"sinon": "^4.4.2", | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.7.2" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "tsc -p tsconfig.build.json", | ||
"clean": "rimraf dist coverage", | ||
"lint": "tslint --config ../../tslint.json src/**/*", | ||
"format": "prettier --config ../../.prettierrc.json src/**/* --write", | ||
"lint": "run-s lint:prettier lint:tslint", | ||
"lint:prettier": "prettier-check '{src,test}/**/*.ts'", | ||
"lint:tslint": "tslint -t stylish -p .", | ||
"fix": "run-s fix:tslint fix:prettier", | ||
"fix:prettier": "prettier --write '{src,test}/**/*.ts'", | ||
"fix:tslint": "tslint --fix -t stylish -p .", | ||
"test": "jest", | ||
"test:watch": "jest --watch --notify" | ||
}, | ||
"jest": { | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfigFile": "./tsconfig.json" | ||
} | ||
}, | ||
"collectCoverage": true, | ||
"testEnvironment": "node", | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"moduleFileExtensions": [ | ||
"js", | ||
"ts" | ||
], | ||
"testMatch": [ | ||
"**/*.test.ts" | ||
], | ||
"testPathIgnorePatterns": [ | ||
"/Mock/" | ||
] | ||
} | ||
} |
106
README.md
<p align="center"> | ||
<a href="https://sentry.io" target="_blank" align="center"> | ||
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280"> | ||
</a> | ||
<br/> | ||
<h1>Sentry Node.js SDK Package</h1> | ||
<a href="https://sentry.io" target="_blank" align="center"> | ||
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280"> | ||
</a> | ||
<br /> | ||
</p> | ||
# Official Sentry SDK for NodeJS | ||
[![npm version](https://img.shields.io/npm/v/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) | ||
@@ -13,50 +14,83 @@ [![npm dm](https://img.shields.io/npm/dm/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) | ||
## General | ||
This package is meant to be used with the Core SDK package. | ||
## Usage | ||
First you have to create the core and `use` a corresponding SDK. | ||
To use this SDK, call `SentryClient.create(options)` as early as possible in the | ||
main entry module. This will initialize the SDK and hook into the environment. | ||
Note that you can turn off almost all side effects using the respective options. | ||
```javascript | ||
import * as Sentry from '@sentry/core'; | ||
import { SentryNode } from '@sentry/node'; | ||
import { SentryClient } from '@sentry/node'; | ||
Sentry.create('__DSN__') | ||
.use(SentryNode) | ||
.install(); | ||
SentryClient.create({ | ||
dsn: '__DSN__', | ||
// ... | ||
}); | ||
``` | ||
After that you can call function on the global `sharedClient`: | ||
To set context information or send manual events, use the provided methods on | ||
`SentryClient`. Note that these functions will not perform any action before you | ||
have called `SentryClient.install()`: | ||
```javascript | ||
Sentry.getSharedClient().setTagsContext({ cordova: true }); | ||
Sentry.getSharedClient().captureMessage('test message'); | ||
Sentry.getSharedClient().captureBreadcrumb({ message: 'HOHOHOHO' }); | ||
Sentry.getSharedClient().captureException(new Error('error')); | ||
// Set user information, as well as tags and further extras | ||
SentryClient.setContext({ | ||
extra: { battery: 0.7 }, | ||
tags: { user_mode: 'admin' }, | ||
user: { id: '4711' }, | ||
}); | ||
// Add a breadcrumb for future events | ||
SentryClient.addBreadcrumb({ | ||
message: 'My Breadcrumb', | ||
// ... | ||
}); | ||
// Capture exceptions, messages or manual events | ||
SentryClient.captureMessage('Hello, world!'); | ||
SentryClient.captureException(new Error('Good bye')); | ||
SentryClient.captureEvent({ | ||
message: 'Manual', | ||
stacktrace: [ | ||
// ... | ||
], | ||
}); | ||
``` | ||
## Advanced Usage | ||
If you don't want to use a global static instance of Sentry, you can create one | ||
on your own: | ||
yourself: | ||
```javascript | ||
const client = await new Sentry.Client(dsn).use(MockAdapter).install() | ||
client.setTagsContext({ cordova: true }); | ||
client.captureMessage('test message'); | ||
client.captureBreadcrumb({ message: 'HOHOHOHO' }); | ||
import { NodeFrontend } from '@sentry/node'; | ||
// OR | ||
const client = new NodeFrontend({ | ||
dsn: '__DSN__', | ||
// ... | ||
}); | ||
new Sentry.Client('__DSN__') | ||
.use(MockAdapter) | ||
.install() | ||
.then(client => { | ||
client.setTagsContext({ cordova: true }); | ||
client.captureMessage('test message'); | ||
client.captureBreadcrumb({ message: 'HOHOHOHO' }); | ||
}); | ||
client.install(); | ||
// ... | ||
``` | ||
Notice, `install()` is a `Promise` but we internally wait until it is resolved, | ||
so it is save to call other function without waiting for it. | ||
Note that `install()` returns a `Promise` that resolves when the installation | ||
has finished. It is not necessary to wait for the installation before adding | ||
breadcrumbs, defining context or sending events. However, the return value | ||
indicates whether the installation was successful and the environment could be | ||
instrumented: | ||
```javascript | ||
import { NodeFrontend } from '@sentry/node'; | ||
const client = new NodeFrontend({ | ||
dsn: '__DSN__', | ||
// ... | ||
}); | ||
const success = await client.install(); | ||
if (success) { | ||
// Will capture unhandled promise rejections, etc... | ||
} else { | ||
// Limited instrumentation, but sending events will still work | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
17
461
96
1
29696
3
1
+ Added@sentry/utils@^0.4.0-beta.5
+ Added@sentry/utils@0.4.2(transitive)
Updated@sentry/core@^0.4.0-beta.5
Updatedraven@^2.4.2