terminal
A more robust consoling system making it easier to identify issues on your domain.
About
The terminal is a direct copy of the console. With a few additions. The four main logging functions (log, info, warn, and error) are replaced with a new handler. This handler adds a prefix and performs some coloration.
Notes
- Coloring in the console is only supported by modern browsers.
- There is currently no way to surpress coloring.
Resources
Variable | Type | Purpose |
---|---|---|
terminal.suppress | Boolean | Controls whether log, info, warn, or error will output. |
terminal.prefix | String | A string prefixed to the start of every console output. |
terminal.styles | Object | Indexed by the type of function (log, info, warn, error) containing an array of two schemes for string coloration. First is for the prefix, second is your output. |
Examples
terminal.prefix = '[Nemo]';
// Will output, in dark blue, as [Nemo] Mount Wannahockaloogi...
terminal.info('Mount Wannahockaloogi...');
// Will output, in dark orange, as [Nemo] You get back here. RIGHT. NOW!
terminal.warn('You get back here. RIGHT. NOW!');
// Will output, in dark red, bold, as [Nemo] He touched the butt...
terminal.error('He touched the butt...');