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
import rollbar.logger | |
class SaferRollbarHandler(rollbar.logger.RollbarHandler): | |
def emit(self, record): | |
if record.name == 'rollbar': | |
return | |
super(SaferRollbarHandler, self).emit(record) |
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
_rollbarConfig = { | |
accessToken: "token here", | |
checkIgnore: function(isUncaught, args, payload) { | |
var isIE7 = (window.navigator.userAgent.indexOf("MSIE 7") !== -1); | |
if (isUncaught && isIE7) { | |
// uncaught error, and we are in IE 7. return true to ignore. | |
return true; | |
} | |
// don't ignore anything else | |
return false; |
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
_rollbarConfig = { | |
accessToken: "token here", | |
captureUncaught: true, | |
payload: { | |
environment: "production", | |
// you'll be able to search for this by prefix | |
// i.e. searching for context:home will return items | |
// with occurrences where the context is home#index, home#about, etc. | |
context: "home#index" | |
} |
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
var rollbar = require('rollbar'); | |
rollbar.init("access token here"); | |
function makeRequest(url, args) { | |
// third param is a callback fired upon completion | |
doMakeRequest(url, args, function(response) { | |
// log the request and response to rollbar | |
rollbar.reportMessageWithPayloadData("Made request to " + url, | |
{level: 'info', custom: {request_args: args, response: response}}); | |
}) |
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
[ | |
{ | |
"title": "{{ default_title }} in version {{ server.software }}", | |
"fingerprint": "{{ default_fingerprint }} {{ server.software }}", | |
"condition": {"path": "server.software", "neq": null} | |
} | |
] |
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
diff --git a/rollbar.php b/rollbar.php | |
index f7d7de0..858bf75 100644 | |
--- a/rollbar.php | |
+++ b/rollbar.php | |
@@ -249,6 +249,11 @@ class RollbarNotifier { | |
$data['server'] = $this->build_server_data(); | |
$data['person'] = $this->build_person_data(); | |
+ // use request.code as 'context', so it is searchable | |
+ if ($data['request'] && isset($data['request']['code'])) { |
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
# put all of this in config/initializers/rollbar.rb | |
# from http://hawkins.io/2013/08/using-the-ruby-logger/ | |
class NullLogger < Logger | |
def initialize(*args) | |
end | |
def add(*args, &block) | |
end | |
end |
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
<?php | |
Rollbar::init($config, true, false); // config array, true to install uncaught exception handler, false to not install error handler | |
function my_error_handler($errno, $errstr, $errfile, $errline) { | |
Rollbar::report_php_error($errno, $errstr, $errfile, $errline); | |
// add your own error handling code here | |
} | |
set_error_handler('my_error_handler'); |
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
rollbar.reportMessageWithPayloadData("here is a string message", { | |
level: "info", | |
custom: { | |
"foo": "bar", | |
"other stuff": [1,2,3] | |
} | |
}); |
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
function ignoreRemoteUncaught(isUncaught, args, payload) { | |
try { | |
var filename = payload.data.body.trace.frames[0].filename; | |
if (isUncaught && !filename.match(/^https?:\/\/www\.mycompany\.com/)) { | |
// Ignore uncaught errors that are not from www.mycompany.com. | |
return true; | |
} | |
} catch (e) { | |
// Most likely there was no filename or the frame doesn't exist. | |
} |