{"repo":"Sija/debug.cr","free":true,"listed":false,"github":"https://github.com/Sija/debug.cr","clone":"git clone https://github.com/Sija/debug.cr.git","description":"Debug macro for Crystal","language":"Crystal","stars":105,"topics":["crystal","debugging","macro"],"license":"MIT","category":"dev-tools","readme_excerpt":"debug!(…) A macro for puts -style debugging fans. Debuggers are great. But sometimes you just don't have the time and nerve to set up everything correctly and just want a quick way to inspect some values at runtime. This projects provides debug!(…) macro that can be used in all circumstances where you would typically write puts … or pp … , but with a few extras. Features Easy to read, colorized output Prints file name, line number, function name and the original expression Adds type information for the printed-out value Specialized pretty-printers for selected classes and modules (like Indexable ) Can be used inside expressions Installation 1. Add the dependency to your shard.yml : 2. Run shards install 3. Make sure you compile your program with ENV variable DEBUG set to 1 (for instance DEBUG=1 shards build ). Otherwise all debug!(…) calls will become a no-op. 4. Once your program is compiled, you need to pass DEBUG=1 again on the program start, in order to activate debug!(…) logging. Alternatively, you can call Debug.enabled = true within your code to achieve the same behaviour. Usage The code above produces this output: Configuration You can change the global defaults by calling Debug.configure with a block: There's also Debug::Logger.configure method which allows you to change global defaults related to the logging itself. Customization If you want debug!(…) to work for your custom class, you can simply overload #to debug(io) method within your class. Development Run specs","default_branch":null,"files":null,"tree":[],"storefront":"/r/Sija","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Sija/debug.cr/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}