A console panel in webpage to help 3 use-cases: show console message automatically ; debug mobile ; debug IE/Edge
npm install console-panelA console panel within web page to help in the following use-cases:
* Get notification on console messages
* Console logging on mobile and tablet devices
* Console logging on Microsoft Edge / Internet Explorer (without opening native Developer Tools)
Click here to view online demo.
* console-panel.css
* console-panel.js
In your HTML file, add the following tags:
``html`
In your HTML file, add the following tags:
`html
`
This will initiate the interception logic based on the configuration options and activate console-panel as requested.
Summary: Position of console-panel's icon
position
Type: string "top-left"
Supported positions: , "top-right", "bottom-left", "bottom-right" "bottom-right"
Default value: "top-right"
Example value:
Summary: List of console functions which should be intercepted
functionsToIntercept
Type: OR string "all" OR array (of strings) "window.onerror"
Supported function names: , "console.error", "console.warn", "console.info", "console.log" "all"
Default value: , ["window.onerror", "console.error"]
Example value: console.clear()
Notes: would always get intercepted when consolePanel.enable(config) is called
Summary: List of console function calls for which console-panel icon should be shown
showOnlyForTheseRelevantMessages
Type: OR string "all" OR array (of strings) "window.onerror"
Supported function names: , "console.error", "console.warn", "console.info", "console.log" null
Default value: ["window.onerror", "console.error", "console.warn"]
Example value:
Notes: If it is a , then console-panel notification icon would be shown all the time
Summary: List of console function calls for which console-panel notification should be shown strongly
strongNotificationFor
Type: OR array (of strings) "window.onerror"
Supported function names: , "console.error", "console.warn", "console.info", "console.log" ["window.onerror", "console.error"]
Default value: ["window.onerror", "console.error", "console.warn"]
Example value:
Summary: When it is set as true, "strong-notification" effect is not shown for errors for which stack trace is not available. This can be used to avoid highlighting errors which are occurring due to a cross-origin / third-party script.
skipStrongNotificationIfNoStackTrace
Type: boolean
Allowed values: OR false
Default value: false
Example value:
Summary: When it is set as true
reportLogLines
, the corresponding code line is mentioned along with each console entry. When it is set as true, it may interrupt your debugging session if you are using the "Pause on caught exceptions" feature in browser DevTools boolean
Type:
Allowed values: OR true
Default value: true
Example value:
Summary: Disable console-panel if browser DevTools might be open within the tab
doNotUseWhenDevToolsMightBeOpenInTab
Type: boolean
Allowed values: OR false
Default value: false
Example value:
Reference: https://github.com/sindresorhus/devtools-detect#support
Summary: Customize the title for the "disable" button in console-panel
disableButtonTitle
Type: string "Disable for this instance"
Allowed values: Any non-empty string
Default value: "Disable\n(and keep disabled)"
Example value:
Summary: Function to be called before performing the default action for "disable" button
beforeDisableButtonClick
Type: function function () { localStorage['console-panel-status'] = 'disabled'; }
Example value: false
Notes: If this function returns boolean , then the default action would not be performed
`js`
// Enable console-panel in default mode.
// Use this configuration for getting notified about console messages and
// debugging for mobile devices and IE/Edge.
consolePanel.enable();
`js`
// Intercept only error logs.
// Use this configuration to ensure that you don't miss out on any errors, while
// continuing to use native DevTools logger for all other log entries.
consolePanel.enable({
functionsToIntercept: ['window.onerror', 'console.error']
});
`js`
// Do not use console-panel when browser's DevTools might be open in the tab.
// Use this configuration to avoid using console-panel when you are debugging
// with the help of native DevTools.
consolePanel.enable({
doNotUseWhenDevToolsMightBeOpenInTab: true
});
`js`
// Hide console-panel icon by default. But, show it as soon as any console
// related message shows up.
// Use this configuration if you wish to avoid seeing the console-panel icon as
// long as it doesn't serve an important purpose.
consolePanel.enable({
showOnlyForTheseRelevantMessages: 'all'
});
`js`
// Show strong notification for all console related messages.
// Use this configuration if you wish to catch any console messages missed out
// from code clean up.
consolePanel.enable({
strongNotificationFor: 'all'
});
`js`
// Do not report the code lines for messages in console-panel.
// Use this configuration if you wish to use "Pause on caught exceptions"
// feature in browser DevTools (which would otherwise get interrupted by dummy
// errors thrown by console-panel to report the code lines accurately).
consolePanel.enable({
reportLogLines: false
});
`js`
// Skip strong-notification effect for errors without stack trace.
// Use this configuration if you wish to ignore errors caused by cross-origin
// (usually third-party) scripts where stack traces are not available.
consolePanel.enable({
skipStrongNotificationIfNoStackTrace: true
});
`js`
// Add custom logic around the "Disable for this instance" button.
// Use this configuration if you wish to disable console-panel and keep it
// disabled for future page loads.
if (localStorage['console-panel-status'] !== 'disabled') {
consolePanel.enable({
disableButtonTitle: 'Disable\n(and keep disabled)',
beforeDisableButtonClick: function () {
localStorage['console-panel-status'] = 'disabled';
}
});
}
If you wish to deactivate console-panel, run consolePanel.disable(). It will restore the intercepted functions to their original state.
Google Chrome
Microsoft Edge (and Internet Explorer)
Mozilla Firefox
Opera
* console.clear() is always intercepted whenever consolePanel.enable() is called.window.onerror
* In Microsoft Edge (EdgeHTML) and Internet Explorer, the console functions are
not intercepted if the browser's native Developer Tools are in activated state
( can still be intercepted). Also, for these browsers, if theconsolePanel.enable(config)
native Developer Tools have been opened once, then the intercepted calls to the
console logging function calls are absorbed (rather than intercepted).
* During a page load, if has already been called once,consolePanel.enable(config_new)
then calling with a different config may not work
well for all the cases.
* Android: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/
Remote debugging
* iOS: https://github.com/google/ios-webkit-debug-proxy
A lightweight, extendable front-end developer tool for mobile web page (https://github.com/Tencent/vConsole)
vConsole
In your HTML file, add the following tags: References:
Firebug Lite
`html``
* https://blog.getfirebug.com/2013/08/21/firebug-1-12-0/
* https://blog.getfirebug.com/2013/05/02/future-of-firebug-lite/
* http://www.softwareishard.com/blog/planet-mozilla/how-to-start-with-firebug-lite/
* Priyank Parashar - GitHub | Twitter | LinkedIn
* https://webextensions.org/
* GitHub
* Twitter
* MIT