From efca96afd95e9891e33fc86d59093796a51f6ee4 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 18 Apr 2015 01:04:35 +0300 Subject: [PATCH] Beta changes --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- index.js | 5 +++++ package.json | 27 ++++++++++++++++++++------- 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 54c92e3..f18b841 100644 --- a/README.md +++ b/README.md @@ -1 +1,43 @@ -# Sails hook for Sentry(raven-node) +# sails-hook-sentry + +[Sails JS](http://sailsjs.org) hook to log errors and stack traces in [Sentry](https://github.com/getsentry/sentry) from within your Sails.js applications. + +### Installation + +`npm install sails-hook-sentry` + +### Usage +*requires at least sails >= 0.11* + +### Configuration + +By default, configuration lives in `sails.config.sentry`. The configuration key (`sentry`) can be changed by setting `sails.config.hooks['sails-hook-sentry'].configKey`. + +#### Example + +```javascript +// [your-sails-app]/config/sentry.js +module.exports.sentry = { + active: true, + dsn: "{{ DSN }}", + level: 'error' +}; +``` + +```javascript +// [your-sails-app]/api/controllers/UserController.js +/** + * UserController + * + * @description :: Server-side logic for managing users + * @help :: See http://links.sailsjs.org/docs/controllers + */ + +module.exports = { + find: function(req, res) { + sails.sentry.captureMessage("Another message"); + res.ok('ok'); + } +}; +``` +More *sails.sentry* methods [raven-node](https://github.com/getsentry/raven-node) diff --git a/index.js b/index.js index f0687dc..f9db817 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,11 @@ module.exports = function(sails) { return cb(); } + if (!sails.config[this.configKey].dsn) { + sails.log.verbose("DSN for Sentry is required."); + return cb(); + } + var client = new raven.Client( sails.config[this.configKey].dsn, { diff --git a/package.json b/package.json index b719a8f..1a04109 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,41 @@ { "name": "sails-hook-sentry", - "version": "1.0.0", + "version": "1.0.0-beta.1", "description": "Sails hook for Sentry(raven-node)", "main": "index.js", + "keywords": [ + "raven", + "sentry", + "node", + "errors", + "debugging", + "exceptions", + "sails", + "hook" + ], "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", - "url": "https://github.com/listepo/sails-hook-raven-node.git" + "url": "https://github.com/listepo/sails-hook-sentry.git" }, - "author": "", + "author": "Ivan Tugay ", "license": "ISC", "bugs": { - "url": "https://github.com/listepo/sails-hook-raven-node/issues" + "url": "https://github.com/listepo/sails-hook-sentry/issues" }, - "homepage": "https://github.com/listepo/sails-hook-raven-node", + "homepage": "https://github.com/listepo/sails-hook-sentry", "sails": { "isHook": true }, - "devDependencies": { - "sails": "^0.11.0" + "engines": { + "node": ">= 0.12" }, "dependencies": { "raven": "^0.7.3" + }, + "devDependencies": { + "sails": "^0.11.0" } }