Introduction
Tame the JS console by automagically grouping console messages.
- Simple: Drop in replacement for the full console API.
- Automatic: Groups messages by each Event Loop iteration.
- Easier Debugging: Makes it much clearer to see what is going on in your app.
- Adds Time Stamps: Each grouping can be timestamped, to help better see what is happening.
- Reliable: Uses a Microtask to ensure the message group is always closed on time.
A more readable console output in a couple of minutes.
Above created by example.ts.
Install
Install auto-console-group via npm.
npm install auto-console-group
Or download auto-console-group.js
Setup
The createAutoConsoleGroup()
creates a console object with all the same methods as the regular console
object,
plus a few additional methods to control how a group is displayed.
import createAutoConsoleGroup from 'auto-console-group'
const consoleGroup = createAutoConsoleGroup({ label: 'autoConsoleGroup' })
// All console methods are reflected on consoleGroup
consoleGroup.log('Log message')
consoleGroup.table(['foo', 'bar'])
consoleGroup.count('Counter')
// Set the Event in the group heading
consoleGroup.event('myEvent')