# Debug
When in Graphery SVG we create a wrong element or call a wrong method, this error is handled silently and no errors are
displayed. With the debug
plugin the error and the calls are shown in the console.
import gySVG from 'https://cdn.graphery.online/svg/1.0.0/module/index.js';
import debug from 'https://cdn.graphery.online/svg/1.0.0/module/debug.plugin.js';
gySVG.extend(debug);
gySVG.debugLevel(gySVG.DEBUG_ALL);
const svg = gySVG(); // console output: gySVG debug - call gySVG( )
svg.viewBox(0, 0, 100, 100); // console output: gySVG debug - call svg.viewBox( 0, 0, 100, 100 )
svg.add('wrong'); // console output: gySVG debug - invalid element svg.add( 'wrong' ) at ...
You can use the gySVG.debugLevel()
method to define the level of messages sent to the console:
gySVG.DEBUG_NONE
- no messages.gySVG.DEBUG_ERROR
- display only error messages.gySVG.DEBUG_WARNING
- display only error and warning messages.gySVG.DEBUG_ALL
- display all messages