Do you ever use print() or log() to debug your code? Of course you do. IceCream, or ic for short, makes print debugging a little sweeter. With arguments, ic() inspects itself and prints both its own arguments and the values of those arguments. Just give ic() a variable or expression and you're done. ic() returns its argument(s), so ic() can easily be inserted into pre-existing code. Additionally, ic()'s output can be entirely disabled, and later re-enabled, with ic.disable() and ic.enable() respectively. ic() continues to return its arguments when disabled, of course; no existing code with ic() breaks. To make ic() available in every file without needing to be imported in every file, you can install() it. ic() can also be imported in a manner that fails gracefully if IceCream isn't installed, like in production environments (i.e. not development).
Features
- Prints both expressions/variable names and their values
- It's 40% faster to type
- Data structures are pretty printed
- Output is syntax highlighted
- It optionally includes program context