diff --git a/plugins/console.js b/plugins/console.js index 16b42bc36257..795e6d6b29ca 100644 --- a/plugins/console.js +++ b/plugins/console.js @@ -3,14 +3,20 @@ * * Monkey patches console.* calls into Sentry messages with * their appropriate log levels. (Experimental) + * + * Options: + * + * `levels`: An array of levels (methods on `console`) to report to Sentry. + * Defaults to debug, info, warn, and error. */ 'use strict'; -function consolePlugin(Raven, console) { +function consolePlugin(Raven, console, pluginOptions) { console = console || window.console || {}; + pluginOptions = pluginOptions || {}; var originalConsole = console, - logLevels = ['debug', 'info', 'warn', 'error'], + logLevels = pluginOptions.levels || ['debug', 'info', 'warn', 'error'], level = logLevels.pop(); var logForGivenLevel = function(l) { @@ -36,7 +42,6 @@ function consolePlugin(Raven, console) { }; }; - while(level) { console[level] = logForGivenLevel(level); level = logLevels.pop();